Util: Add more ways of accessing and creating Json::Value objects

This commit is contained in:
Riyyi
2022-06-23 13:47:07 +02:00
parent 9f7fe81ef6
commit 8bfae9b483
4 changed files with 96 additions and 7 deletions
+12 -2
View File
@@ -7,7 +7,9 @@
#ifndef JSON_VALUE_H
#define JSON_VALUE_H
#include <cstddef> // nullptr_t
#include <cstdint> // uint32_t
#include <initializer_list>
#include <iostream> // istream, ostream
#include <string>
@@ -36,20 +38,28 @@ public:
Value& operator=(const Value& other);
Value(bool value);
Value(int value);
Value(double value);
Value(const char* value);
Value(const std::string& value);
Value(const Array& value);
Value(const Object& value);
Value(const std::initializer_list<Value>& values);
// ------------------------------------------
static Value parse(const std::string& input);
std::string dump(const uint32_t indent = 0, const char indentCharacter = ' ') const;
// ------------------------------------------
// Array index operator
Value operator[](size_t index);
Value operator[](const std::string& key);
Value& operator[](size_t index);
Value& operator[](const std::string& key);
const Value& operator[](size_t index) const;
const Value& operator[](const std::string& key) const;
// ------------------------------------------
Type type() const { return m_type; }