2024-02-05 22:25:30 -08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ehs/EHS.h"
|
|
|
|
#include "ehs/Str.h"
|
|
|
|
#include "JsonBase.h"
|
|
|
|
|
|
|
|
namespace ehs
|
|
|
|
{
|
|
|
|
class JsonObj;
|
|
|
|
class JsonBool;
|
|
|
|
class JsonNum;
|
|
|
|
class JsonStr;
|
|
|
|
|
2024-07-24 01:36:20 -07:00
|
|
|
class EHS_LIB_IO JsonArray : public JsonBase
|
2024-02-05 22:25:30 -08:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
UInt_64 size;
|
|
|
|
UInt_64 extra;
|
|
|
|
UInt_64 rawSize;
|
|
|
|
JsonBase** data;
|
|
|
|
|
|
|
|
public:
|
2024-08-15 19:28:30 -07:00
|
|
|
~JsonArray() override;
|
2024-02-05 22:25:30 -08:00
|
|
|
|
|
|
|
JsonArray();
|
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
JsonArray(UInt_64 extra);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
JsonArray(UInt_64 size, UInt_64 extra);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
|
|
|
JsonArray(JsonArray&& ja) noexcept;
|
|
|
|
|
|
|
|
JsonArray(const JsonArray& ja);
|
|
|
|
|
|
|
|
JsonArray& operator=(JsonArray&& ja) noexcept;
|
|
|
|
|
|
|
|
JsonArray& operator=(const JsonArray& ja);
|
|
|
|
|
|
|
|
operator JsonBase* const *() const;
|
|
|
|
|
|
|
|
operator JsonBase**();
|
|
|
|
|
|
|
|
UInt_64 RawSize() const;
|
|
|
|
|
|
|
|
UInt_64 Extra() const;
|
|
|
|
|
|
|
|
UInt_64 Size() const;
|
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
void Insert(UInt_64 index, const JsonBase* value);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
void Push(const JsonBase* value);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
|
|
|
void Push(const JsonBase& value);
|
|
|
|
|
|
|
|
void Push(const JsonObj& value);
|
|
|
|
|
|
|
|
void Push(const JsonArray& value);
|
|
|
|
|
|
|
|
void Push(const JsonBool& value);
|
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
void Push(bool value);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
|
|
|
void Push(const JsonNum& value);
|
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
void Push(float value);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
|
|
|
void Push(const JsonStr& value);
|
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
void Push(const Char_8* value, UInt_64 size = 0);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
|
|
|
void Push(const Str_8& value);
|
|
|
|
|
|
|
|
void Pop();
|
|
|
|
|
2024-08-15 19:28:30 -07:00
|
|
|
Str_8 ToStr(UInt_64 level, bool compact) const override;
|
2024-02-05 22:25:30 -08:00
|
|
|
};
|
|
|
|
}
|