EHS/include/ehs/json/Json.h
karutoh 1a4a1ecd9c
Some checks failed
Build & Release / Linux-x86_64-Build (push) Successful in 40s
Build & Release / Linux-AARCH64-Build (push) Has been cancelled
First commit.
2024-01-31 22:28:19 -08:00

68 lines
1.5 KiB
C++

#pragma once
#include "ehs/EHS.h"
#include "ehs/Str.h"
#include "JsonBase.h"
#include "JsonObj.h"
#include "JsonArray.h"
#include "JsonBool.h"
#include "JsonNum.h"
#include "JsonStr.h"
#include "JsonVar.h"
namespace ehs
{
class Json
{
private:
JsonBase* value;
public:
virtual ~Json();
Json();
Json(const JsonBase& value);
Json(const JsonObj& value);
Json(const JsonArray& value);
Json(const JsonBool& value);
Json(const JsonNum& value);
Json(const JsonStr& value);
Json(const char* data, const UInt_64 size, const UInt_64 extra);
Json(const Str_8& data, const UInt_64 extra);
Json(Json&& json) noexcept;
Json(const Json &json);
Json& operator=(Json&& json) noexcept;
Json& operator=(const Json& json);
JsonBase* GetValue();
JsonBase* RetrieveValue(const Str_8& access);
Str_8 ToStr(const bool compact) const;
private:
static Vector<Str_8> ParseAccess(const Str_8& access);
void ParseValue(JsonVar* var, const Char_8** begin, const Char_8* end, const UInt_64 extra);
JsonVar ParseVar(const Char_8** begin, const Char_8* end, const UInt_64 extra);
void ParseObject(JsonObj* obj, const Char_8** begin, const Char_8* end, const UInt_64 extra);
void ParseArray(JsonArray* arr, const Char_8** begin, const Char_8* end, const UInt_64 extra);
void Parse(const Str_8& data, const UInt_64 extra);
};
}