Ember
Loading...
Searching...
No Matches
ParserProfile.h
Go to the documentation of this file.
1#pragma once
2
4#include "Types/Types.h"
5#include <chrono>
6#include <memory>
7
8namespace EmberCore {
9
17 public:
19 explicit ParserProfile(const String &name, const String &description = "");
20 ~ParserProfile() = default;
21
22 // Profile metadata
23 String GetName() const { return name_; }
24 void SetName(const String &name) { name_ = name; }
25
27 void SetDescription(const String &description) { description_ = description; }
28
29 String GetVersion() const { return version_; }
30 void SetVersion(const String &version) { version_ = version; }
31
32 String GetAuthor() const { return author_; }
33 void SetAuthor(const String &author) { author_ = author; }
34
35 int64_t GetCreatedTimestamp() const { return created_timestamp_; }
36 int64_t GetModifiedTimestamp() const { return modified_timestamp_; }
38
39 // Configuration access
41 const ParserConfig &GetConfig() const { return config_; }
42 void SetConfig(const ParserConfig &config);
43
44 // Validation
45 bool Validate(std::vector<String> &errors) const;
46
47 // JSON serialization/deserialization
48 nlohmann::json ToJson() const;
49 void FromJson(const nlohmann::json &json);
50
51 // File I/O
52 bool SaveToFile(const String &filepath) const;
53 bool LoadFromFile(const String &filepath);
54
55 // Cloning
56 std::shared_ptr<ParserProfile> Clone(const String &new_name = "") const;
57
58 // Factory methods for creating default profiles
59 static std::shared_ptr<ParserProfile> CreateDefaultProfile();
60 static std::shared_ptr<ParserProfile> CreateGenericProfile();
61
62 private:
70
71 // Helper to get current timestamp
72 static int64_t GetCurrentTimestamp();
73};
74
75} // namespace EmberCore
Configuration for XML parser behavior and element/attribute mappings.
String GetDescription() const
static std::shared_ptr< ParserProfile > CreateGenericProfile()
void SetName(const String &name)
void SetAuthor(const String &author)
static int64_t GetCurrentTimestamp()
nlohmann::json ToJson() const
static std::shared_ptr< ParserProfile > CreateDefaultProfile()
bool LoadFromFile(const String &filepath)
void SetVersion(const String &version)
bool Validate(std::vector< String > &errors) const
void SetConfig(const ParserConfig &config)
int64_t GetCreatedTimestamp() const
void FromJson(const nlohmann::json &json)
String GetVersion() const
void SetDescription(const String &description)
std::shared_ptr< ParserProfile > Clone(const String &new_name="") const
int64_t GetModifiedTimestamp() const
bool SaveToFile(const String &filepath) const
const ParserConfig & GetConfig() const
ParserConfig & GetConfig()
Main types header for EmberCore.
std::string String
Framework-agnostic string type.
Definition String.h:14