2024-02-05 22:25:30 -08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ehs/EHS.h"
|
|
|
|
#include "ehs/Str.h"
|
|
|
|
|
|
|
|
namespace ehs
|
|
|
|
{
|
|
|
|
class JsonBase;
|
|
|
|
class JsonObj;
|
|
|
|
class JsonArray;
|
|
|
|
class JsonBool;
|
|
|
|
class JsonNum;
|
|
|
|
class JsonStr;
|
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
class EHS_LIB_IO JsonVar final
|
2024-02-05 22:25:30 -08:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
UInt_64 hashId;
|
|
|
|
Str_8 id;
|
|
|
|
JsonBase* value;
|
|
|
|
|
|
|
|
public:
|
2024-08-15 19:28:30 -07:00
|
|
|
~JsonVar();
|
2024-02-05 22:25:30 -08:00
|
|
|
|
|
|
|
JsonVar();
|
|
|
|
|
|
|
|
JsonVar(Str_8 id);
|
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
JsonVar(Str_8 id, const JsonBase *value);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
JsonVar(Str_8 id, const JsonBase &value);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
JsonVar(Str_8 id, const JsonObj &value);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
JsonVar(Str_8 id, const JsonArray &value);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
JsonVar(Str_8 id, const JsonBool &value);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
JsonVar(Str_8 id, bool boolean);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
JsonVar(Str_8 id, const JsonNum &value);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
JsonVar(Str_8 id, SInt_64 num);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
JsonVar(Str_8 id, UInt_64 num);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
JsonVar(Str_8 id, SInt_32 num);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
JsonVar(Str_8 id, UInt_32 num);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
JsonVar(Str_8 id, SInt_16 num);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
JsonVar(Str_8 id, UInt_16 num);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
JsonVar(Str_8 id, SInt_8 num);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
JsonVar(Str_8 id, UInt_8 num);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
JsonVar(Str_8 id, double num);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
JsonVar(Str_8 id, float num);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
JsonVar(Str_8 id, const JsonStr &value);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
JsonVar(Str_8 id, const Char_8 *str, UInt_64 size = 0);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
|
|
|
JsonVar(Str_8 id, Str_8 str);
|
|
|
|
|
|
|
|
JsonVar(JsonVar&& var) noexcept;
|
|
|
|
|
|
|
|
JsonVar(const JsonVar& var);
|
|
|
|
|
|
|
|
JsonVar& operator=(JsonVar&& var) noexcept;
|
|
|
|
|
|
|
|
JsonVar& operator=(const JsonVar& var);
|
|
|
|
|
|
|
|
UInt_64 GetHashId() const;
|
|
|
|
|
|
|
|
Str_8 GetId() const;
|
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
void SetValue(const JsonBase *newValue);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
void SetValue(const JsonBase &newValue);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
void SetValue(const JsonObj &newValue);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
void SetValue(const JsonArray &newValue);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
void SetValue(const JsonBool &newValue);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
void SetValue(bool newValue);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
|
|
|
void SetValue(const JsonNum& newValue);
|
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
void SetValue(float newValue);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
|
|
|
void SetValue(const JsonStr& newValue);
|
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
void SetValue(const Char_8* newValue, UInt_64 size = 0);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
|
|
|
void SetValue(const Str_8& newValue);
|
|
|
|
|
|
|
|
const JsonBase* GetValue() const;
|
|
|
|
|
|
|
|
JsonBase* GetValue();
|
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
Str_8 ToStr(UInt_64 level, bool compact) const;
|
2024-02-05 22:25:30 -08:00
|
|
|
};
|
|
|
|
}
|