EHS/include/ehs/json/JsonObj.h

61 lines
1010 B
C++

#pragma once
#include "ehs/EHS.h"
#include "ehs/Str.h"
#include "JsonBase.h"
namespace ehs
{
class JsonVar;
class EHS_LIB_IO JsonObj final : public JsonBase
{
protected:
UInt_64 size;
UInt_64 extra;
UInt_64 rawSize;
JsonVar* vars;
public:
~JsonObj() override;
JsonObj();
JsonObj(UInt_64 size, UInt_64 extra);
JsonObj(UInt_64 extra);
JsonObj(JsonObj &&value) noexcept;
JsonObj(const JsonObj &value);
JsonObj& operator=(JsonObj &&value) noexcept;
JsonObj& operator=(const JsonObj &value);
operator JsonVar *() const;
UInt_64 Size() const;
UInt_64 Extra() const;
UInt_64 RawSize() const;
bool HasVar(UInt_64 hashId) const;
bool HasVar(const Str_8 &identifier) const;
bool AddVar(const JsonVar &var);
const JsonVar *GetVar(UInt_64 hashId) const;
const JsonVar *GetVar(const Str_8& identifier) const;
JsonVar *GetVar(UInt_64 hashId);
JsonVar *GetVar(const Str_8& identifier);
Str_8 ToStr(UInt_64 level, bool compact) const override;
};
}