mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-08-12 19:19:43 +00:00
cfg: Use ordered json for serialization
This commit is contained in:
parent
6a5471f718
commit
df4456cfc0
2 changed files with 14 additions and 14 deletions
|
@ -531,9 +531,9 @@ std::string cfg::node::to_string() const
|
||||||
return {out.c_str(), out.size()};
|
return {out.c_str(), out.size()};
|
||||||
}
|
}
|
||||||
|
|
||||||
nlohmann::json cfg::node::to_json() const
|
nlohmann::ordered_json cfg::node::to_json() const
|
||||||
{
|
{
|
||||||
auto result = nlohmann::json::object();
|
auto result = nlohmann::ordered_json::object();
|
||||||
|
|
||||||
for (const auto& node : get_nodes())
|
for (const auto& node : get_nodes())
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,7 +97,7 @@ namespace cfg
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual nlohmann::json to_json() const = 0;
|
virtual nlohmann::ordered_json to_json() const = 0;
|
||||||
virtual bool from_json(const nlohmann::json &, bool dynamic = false) = 0;
|
virtual bool from_json(const nlohmann::json &, bool dynamic = false) = 0;
|
||||||
|
|
||||||
// Convert default to string (optional)
|
// Convert default to string (optional)
|
||||||
|
@ -149,7 +149,7 @@ namespace cfg
|
||||||
|
|
||||||
// Serialize node
|
// Serialize node
|
||||||
std::string to_string() const override;
|
std::string to_string() const override;
|
||||||
nlohmann::json to_json() const override;
|
nlohmann::ordered_json to_json() const override;
|
||||||
|
|
||||||
// Deserialize node
|
// Deserialize node
|
||||||
bool from_string(std::string_view value, bool dynamic = false) override;
|
bool from_string(std::string_view value, bool dynamic = false) override;
|
||||||
|
@ -190,7 +190,7 @@ namespace cfg
|
||||||
return m_value ? "true" : "false";
|
return m_value ? "true" : "false";
|
||||||
}
|
}
|
||||||
|
|
||||||
nlohmann::json to_json() const override
|
nlohmann::ordered_json to_json() const override
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
{
|
{
|
||||||
|
@ -290,7 +290,7 @@ namespace cfg
|
||||||
return result; // TODO: ???
|
return result; // TODO: ???
|
||||||
}
|
}
|
||||||
|
|
||||||
nlohmann::json to_json() const override
|
nlohmann::ordered_json to_json() const override
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
{
|
{
|
||||||
|
@ -383,7 +383,7 @@ namespace cfg
|
||||||
return std::to_string(m_value);
|
return std::to_string(m_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
nlohmann::json to_json() const override
|
nlohmann::ordered_json to_json() const override
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
{
|
{
|
||||||
|
@ -490,7 +490,7 @@ namespace cfg
|
||||||
return "0.0";
|
return "0.0";
|
||||||
}
|
}
|
||||||
|
|
||||||
nlohmann::json to_json() const override
|
nlohmann::ordered_json to_json() const override
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
{
|
{
|
||||||
|
@ -605,7 +605,7 @@ namespace cfg
|
||||||
return std::to_string(m_value);
|
return std::to_string(m_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
nlohmann::json to_json() const override
|
nlohmann::ordered_json to_json() const override
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
{
|
{
|
||||||
|
@ -696,7 +696,7 @@ namespace cfg
|
||||||
return *m_value.load().get();
|
return *m_value.load().get();
|
||||||
}
|
}
|
||||||
|
|
||||||
nlohmann::json to_json() const override
|
nlohmann::ordered_json to_json() const override
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
{
|
{
|
||||||
|
@ -758,7 +758,7 @@ namespace cfg
|
||||||
return { m_set.begin(), m_set.end() };
|
return { m_set.begin(), m_set.end() };
|
||||||
}
|
}
|
||||||
|
|
||||||
nlohmann::json to_json() const override
|
nlohmann::ordered_json to_json() const override
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
{
|
{
|
||||||
|
@ -818,7 +818,7 @@ namespace cfg
|
||||||
return m_map;
|
return m_map;
|
||||||
}
|
}
|
||||||
|
|
||||||
nlohmann::json to_json() const override
|
nlohmann::ordered_json to_json() const override
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
{
|
{
|
||||||
|
@ -877,7 +877,7 @@ namespace cfg
|
||||||
return m_map;
|
return m_map;
|
||||||
}
|
}
|
||||||
|
|
||||||
nlohmann::json to_json() const override
|
nlohmann::ordered_json to_json() const override
|
||||||
{
|
{
|
||||||
auto levels = try_to_enum_list(&fmt_class_string<logs::level>::format);
|
auto levels = try_to_enum_list(&fmt_class_string<logs::level>::format);
|
||||||
auto values = nlohmann::json::object();
|
auto values = nlohmann::json::object();
|
||||||
|
@ -1010,7 +1010,7 @@ namespace cfg
|
||||||
m_default = m_map;
|
m_default = m_map;
|
||||||
}
|
}
|
||||||
|
|
||||||
nlohmann::json to_json() const override
|
nlohmann::ordered_json to_json() const override
|
||||||
{
|
{
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue