EHS/include/ehs/json/JsonObj.h

61 lines
1010 B
C
Raw Normal View History

2024-02-05 22:25:30 -08:00
#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
2024-02-05 22:25:30 -08:00
{
protected:
UInt_64 size;
UInt_64 extra;
UInt_64 rawSize;
JsonVar* vars;
public:
~JsonObj() override;
2024-02-05 22:25:30 -08:00
JsonObj();
JsonObj(UInt_64 size, UInt_64 extra);
2024-02-05 22:25:30 -08:00
JsonObj(UInt_64 extra);
2024-02-05 22:25:30 -08:00
JsonObj(JsonObj &&value) noexcept;
2024-02-05 22:25:30 -08:00
JsonObj(const JsonObj &value);
2024-02-05 22:25:30 -08:00
JsonObj& operator=(JsonObj &&value) noexcept;
2024-02-05 22:25:30 -08:00
JsonObj& operator=(const JsonObj &value);
2024-02-05 22:25:30 -08:00
operator JsonVar *() const;
2024-02-05 22:25:30 -08:00
UInt_64 Size() const;
UInt_64 Extra() const;
UInt_64 RawSize() const;
bool HasVar(UInt_64 hashId) const;
2024-02-05 22:25:30 -08:00
bool HasVar(const Str_8 &identifier) const;
2024-02-05 22:25:30 -08:00
bool AddVar(const JsonVar &var);
2024-02-05 22:25:30 -08:00
const JsonVar *GetVar(UInt_64 hashId) const;
2024-02-05 22:25:30 -08:00
const JsonVar *GetVar(const Str_8& identifier) const;
2024-02-05 22:25:30 -08:00
JsonVar *GetVar(UInt_64 hashId);
2024-02-05 22:25:30 -08:00
JsonVar *GetVar(const Str_8& identifier);
2024-02-05 22:25:30 -08:00
Str_8 ToStr(UInt_64 level, bool compact) const override;
2024-02-05 22:25:30 -08:00
};
}