115 [[nodiscard]]
size_t Size()
const;
141#include <Thoth/NJson/JsonObject.tpp>
Definition Definitions.hpp:19
std::string_view JsonObjKeyRef
Definition Definitions.hpp:69
std::optional< CRefValWrapper > OptCRefValWrapper
Definition Definitions.hpp:51
std::optional< RefValWrapper > OptRefValWrapper
Definition Definitions.hpp:50
std::string JsonObjKey
Definition Definitions.hpp:68
std::optional< ValWrapper > OptValWrapper
Definition Definitions.hpp:59
constexpr const_iterator cend() const
constexpr const_iterator cbegin() const
constexpr iterator begin()
Definition Definitions.hpp:32
Definition JsonObject.hpp:14
friend Json
Definition JsonObject.hpp:132
void Set(JsonPairRef p)
Add a value with the specified key. Replace if already exists.
JsonObject & operator=(JsonObject &&other) noexcept
bool Exists(JsonObjKeyRef key, JsonValRef val) const
check if a key=val exists.
bool SetIfNull(JsonPairRef p)
If key not exists, set it to value.
JsonObject(MapType &&initAs)
Create with an existing map.
bool SetIfNull(JsonObjKeyRef key, JsonValRef val)
same as SetIfNull(JsonPairRef p).
ValWrapper GetCopyOrNull(JsonObjKeyRef key) const
Copy of a value or return null if it not exists.
friend bool Details::ReadObject(std::string_view &input, auto &val, const Details::BufferInfo &info)
bool operator==(const JsonObject &other) const
void Clear()
Clear all keys.
const Json & operator[](JsonObjKeyRef key) const
OptValWrapper GetCopy(JsonObjKeyRef key) const
Copy of a value if it exists.
void Set(JsonObjKeyRef key, JsonValRef val)
same as Add(JsonPairRef p).
JsonObject(JsonObject &&other) noexcept
CIterType begin() const
Definition JsonObject.hpp:106
ValWrapper GetOrNullAndMove(JsonObjKeyRef key) &&
Copy of a value or return null if it not exists.
OptRefValWrapper Get(JsonObjKeyRef key)
Get the reference of a key but don't create if it not exists.
OptCRefValWrapper Get(JsonObjKeyRef key) const
Get the reference of a key but don't create if it not exists.
Json & operator[](JsonObjKeyRef key)
CIterType end() const
Definition JsonObject.hpp:107
std::pair< JsonObjKey, Json > JsonPair
Definition JsonObject.hpp:17
std::pair< JsonObjKeyRef, JsonValRef > JsonPairRef
Definition JsonObject.hpp:18
decltype(MapType{}.cbegin()) CIterType
Definition JsonObject.hpp:22
bool Exists(JsonObjKeyRef key) const
check if a key exists.
JsonObject & operator=(const JsonObject &other)
bool Exists(JsonPairRef p) const
check if a key exists.
IterType end()
Definition JsonObject.hpp:105
OptValWrapper GetAndMove(JsonObjKeyRef key) &&
Copy of a value if it exists.
bool Remove(JsonObjKeyRef key)
Removes a key.
JsonObject(const JsonObject &other)
IterType begin()
Definition JsonObject.hpp:104
JsonObject & operator=(std::initializer_list< JsonPair > list)
decltype(MapType{}.begin()) IterType
Definition JsonObject.hpp:21
JsonObject(std::initializer_list< JsonPair > init)