diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2025-01-28 22:53:50 +1100 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2025-01-28 22:53:50 +1100 |
commit | 7fab8c95c29556c6f87de5c19b7487bbf2ea3f93 (patch) | |
tree | 130330a797191348a7a210ac4ad969a66fe28363 /source/core | |
parent | 560e2e2ef8e4cff22eb0a66de7d8b629fd313b9d (diff) |
don't require mod version to be a string
Diffstat (limited to 'source/core')
-rw-r--r-- | source/core/StarJson.cpp | 6 | ||||
-rw-r--r-- | source/core/StarJson.hpp | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/source/core/StarJson.cpp b/source/core/StarJson.cpp index 7cf1cda..15b7092 100644 --- a/source/core/StarJson.cpp +++ b/source/core/StarJson.cpp @@ -868,6 +868,12 @@ String Json::printJson(int pretty, bool sort) const { return repr(pretty, sort); } +String Json::printString() const { + if (type() == Type::String) + return *m_data.get<StringConstPtr>(); + return repr(); +} + std::ostream& operator<<(std::ostream& os, Json const& v) { outputUtf8Json(v, std::ostream_iterator<char>(os), 0, false); return os; diff --git a/source/core/StarJson.hpp b/source/core/StarJson.hpp index b58b9a0..fb4c229 100644 --- a/source/core/StarJson.hpp +++ b/source/core/StarJson.hpp @@ -253,6 +253,8 @@ public: String repr(int pretty = 0, bool sort = false) const; // Prints JSON object or array only (only top level types allowed by JSON) String printJson(int pretty = 0, bool sort = false) const; + // Same but avoids quotation marks if this is a string + String printString() const; // operator== and operator!= compare for exact equality with all types, and // additionally equality with numeric conversion with Int <-> Float |