Update Metadata
It should match with its original structure.
This commit is contained in:
parent
c574e46a96
commit
42c977b300
|
@ -47,13 +47,18 @@ public:
|
|||
const std::string = "1.0.0_gen" SPECIESGEN_VERSION,
|
||||
const std::string = "http://git.vern.cc/prisixia/speciesgen",
|
||||
const std::vector<std::string> = {"starpounds"});
|
||||
|
||||
std::string GetName() const;
|
||||
std::string GetFriendlyName() const;
|
||||
std::string GetDescription() const;
|
||||
std::string GetAuthor() const;
|
||||
std::string GetVersion() const;
|
||||
std::string GetLink() const;
|
||||
std::string GetSteamContentID() const;
|
||||
std::string GetTags() const;
|
||||
std::vector<std::string> GetIncludes() const;
|
||||
std::vector<std::string> GetRequires() const;
|
||||
uint32_t GetPriority() const;
|
||||
|
||||
void SetName(const std::string);
|
||||
void SetFriendlyName(const std::string);
|
||||
|
@ -61,7 +66,11 @@ public:
|
|||
void SetAuthor(const std::string);
|
||||
void SetVersion(const std::string);
|
||||
void SetLink(const std::string);
|
||||
void SetSteamContentID(const std::string);
|
||||
void SetTags(const std::string);
|
||||
void SetIncludes(const std::vector<std::string>);
|
||||
void SetRequires(const std::vector<std::string>);
|
||||
void SetPriority(const uint32_t);
|
||||
|
||||
void Serialize(const std::filesystem::path) const;
|
||||
template <typename Writer> void Serialize(Writer &) const;
|
||||
|
@ -73,7 +82,11 @@ private:
|
|||
std::string m_author;
|
||||
std::string m_version;
|
||||
std::string m_link;
|
||||
std::string m_steamContentId;
|
||||
std::string m_tags;
|
||||
std::vector<std::string> m_includes;
|
||||
std::vector<std::string> m_requires;
|
||||
uint32_t m_priority;
|
||||
};
|
||||
} // namespace Starbound
|
||||
|
||||
|
|
|
@ -46,8 +46,16 @@ std::string Metadata::GetVersion() const { return m_version; }
|
|||
|
||||
std::string Metadata::GetLink() const { return m_link; }
|
||||
|
||||
std::string Metadata::GetSteamContentID() const { return m_steamContentId; }
|
||||
|
||||
std::string Metadata::GetTags() const { return m_tags; }
|
||||
|
||||
std::vector<std::string> Metadata::GetIncludes() const { return m_includes; }
|
||||
|
||||
std::vector<std::string> Metadata::GetRequires() const { return m_requires; }
|
||||
|
||||
uint32_t Metadata::GetPriority() const { return m_priority; }
|
||||
|
||||
void Metadata::SetName(const std::string name) { m_name = name; }
|
||||
|
||||
void Metadata::SetFriendlyName(const std::string friendlyName) {
|
||||
|
@ -64,10 +72,22 @@ void Metadata::SetVersion(const std::string version) { m_version = version; }
|
|||
|
||||
void Metadata::SetLink(const std::string link) { m_link = link; }
|
||||
|
||||
void Metadata::SetSteamContentID(const std::string steamContentId) {
|
||||
m_steamContentId = steamContentId;
|
||||
}
|
||||
|
||||
void Metadata::SetTags(const std::string tags) { m_tags = tags; }
|
||||
|
||||
void Metadata::SetIncludes(const std::vector<std::string> includes) {
|
||||
m_includes = includes;
|
||||
}
|
||||
|
||||
void Metadata::SetRequires(const std::vector<std::string> _requires) {
|
||||
m_requires = _requires;
|
||||
}
|
||||
|
||||
void Metadata::SetPriority(const uint32_t priority) { m_priority = priority; }
|
||||
|
||||
void Metadata::Serialize(const std::filesystem::path path) const {
|
||||
std::ofstream file(path);
|
||||
rapidjson::BasicOStreamWrapper wrapper(file);
|
||||
|
@ -85,32 +105,60 @@ template <typename Writer> void Metadata::Serialize(Writer &writer) const {
|
|||
const std::string author = m_author;
|
||||
const std::string version = m_version;
|
||||
const std::string link = m_link;
|
||||
const std::vector<std::string>
|
||||
requires = m_requires;
|
||||
const std::string steamContentId = m_steamContentId;
|
||||
const std::string tags = m_tags;
|
||||
const std::vector<std::string> includes = m_includes;
|
||||
const std::vector<std::string> _requires = m_requires;
|
||||
const uint32_t priority = m_priority;
|
||||
|
||||
writer.Key(RAPIDJSON_STRINGIFY(name));
|
||||
writer.String(name.c_str(),
|
||||
static_cast<rapidjson::SizeType>(name.length()));
|
||||
|
||||
writer.Key(RAPIDJSON_STRINGIFY(friendlyName));
|
||||
writer.String(friendlyName.c_str(),
|
||||
static_cast<rapidjson::SizeType>(friendlyName.length()));
|
||||
|
||||
writer.Key(RAPIDJSON_STRINGIFY(description));
|
||||
writer.String(description.c_str(),
|
||||
static_cast<rapidjson::SizeType>(description.length()));
|
||||
|
||||
writer.Key(RAPIDJSON_STRINGIFY(author));
|
||||
writer.String(author.c_str(),
|
||||
static_cast<rapidjson::SizeType>(author.length()));
|
||||
|
||||
writer.Key(RAPIDJSON_STRINGIFY(version));
|
||||
writer.String(version.c_str(),
|
||||
static_cast<rapidjson::SizeType>(version.length()));
|
||||
|
||||
writer.Key(RAPIDJSON_STRINGIFY(link));
|
||||
writer.String(link.c_str(),
|
||||
static_cast<rapidjson::SizeType>(link.length()));
|
||||
writer.Key(RAPIDJSON_STRINGIFY(requires));
|
||||
|
||||
writer.Key(RAPIDJSON_STRINGIFY(steamContentId));
|
||||
writer.String(steamContentId.c_str(),
|
||||
static_cast<rapidjson::SizeType>(steamContentId.length()));
|
||||
|
||||
writer.Key(RAPIDJSON_STRINGIFY(tags));
|
||||
writer.String(tags.c_str(),
|
||||
static_cast<rapidjson::SizeType>(tags.length()));
|
||||
|
||||
writer.Key("requires");
|
||||
writer.StartArray();
|
||||
for (auto &require : requires)
|
||||
for (auto &require : _requires) {
|
||||
writer.String(require.c_str(),
|
||||
static_cast<rapidjson::SizeType>(require.length()));
|
||||
}
|
||||
writer.EndArray();
|
||||
|
||||
writer.Key(RAPIDJSON_STRINGIFY(includes));
|
||||
writer.StartArray();
|
||||
for (auto &include : includes) {
|
||||
writer.String(include.c_str(),
|
||||
static_cast<rapidjson::SizeType>(include.length()));
|
||||
}
|
||||
writer.EndArray();
|
||||
writer.Key(RAPIDJSON_STRINGIFY(priority));
|
||||
writer.Uint(priority);
|
||||
}
|
||||
} // namespace Starbound
|
||||
|
|
Loading…
Reference in New Issue