mirror of
https://codeberg.org/vyn/rei-json.git
synced 2025-07-03 02:13:18 +00:00
Add 'remove' methods to Object and Array + unify 'set' methods
This commit is contained in:
parent
eb5191a722
commit
fd034eff71
8 changed files with 109 additions and 26 deletions
|
@ -19,12 +19,14 @@ namespace rei::json {
|
|||
JsonArray& push(const std::string& value);
|
||||
JsonArray& push(const std::string&& value);
|
||||
JsonArray& push(const char * value);
|
||||
JsonArray& pushObject(const JsonObject& object);
|
||||
JsonArray& pushObject(const JsonObject&& object);
|
||||
JsonArray& pushArray(const JsonArray& array);
|
||||
JsonArray& pushArray(const JsonArray&& array);
|
||||
JsonArray& push(const JsonObject& object);
|
||||
JsonArray& push(const JsonObject&& object);
|
||||
JsonArray& push(const JsonArray& array);
|
||||
JsonArray& push(const JsonArray&& array);
|
||||
JsonArray& pushNull();
|
||||
|
||||
FieldValue& operator[](unsigned index);
|
||||
|
||||
int getNumber(int index);
|
||||
bool getBool(int index);
|
||||
std::string getString(int index);
|
||||
|
@ -32,6 +34,7 @@ namespace rei::json {
|
|||
JsonArray& getArray(int index);
|
||||
bool hasNull(int index);
|
||||
|
||||
void remove(int index);
|
||||
void forEach(std::function<void(FieldValue&, int)>);
|
||||
size_t count() const;
|
||||
|
||||
|
|
|
@ -21,11 +21,13 @@ namespace rei::json {
|
|||
JsonObject& set(const std::string& key, const std::string& value);
|
||||
JsonObject& set(const std::string& key, const std::string&& value);
|
||||
JsonObject& set(const std::string& key, const char * value);
|
||||
JsonObject& set(const std::string& key, const JsonArray& array);
|
||||
JsonObject& set(const std::string& key, JsonArray&& array);
|
||||
JsonObject& set(const std::string& key, const JsonObject& object);
|
||||
JsonObject& set(const std::string& key, JsonObject&& object);
|
||||
JsonObject& setNull(const std::string& key);
|
||||
JsonObject& addArray(const std::string& key, const JsonArray& array);
|
||||
JsonObject& addArray(const std::string& key, JsonArray&& array);
|
||||
JsonObject& addObject(const std::string& key, const JsonObject& object);
|
||||
JsonObject& addObject(const std::string& key, JsonObject&& object);
|
||||
|
||||
FieldValue& operator[](const std::string& key);
|
||||
|
||||
int getNumber(const std::string& key);
|
||||
bool getBool(const std::string& key);
|
||||
|
@ -34,6 +36,9 @@ namespace rei::json {
|
|||
JsonArray& getArray(const std::string& key);
|
||||
bool hasNull(const std::string& key);
|
||||
|
||||
|
||||
void remove(const std::string& key);
|
||||
|
||||
void forEach(std::function<void(FieldValue&, const std::string& key)>);
|
||||
size_t count() const;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue