esp/io/JsonBuiltinTypes.h file

See JsonAllTypes.h. Don't include this header directly in user code.

Namespaces

namespace esp
Root namespace.
namespace esp::io

Typedefs

using JsonGenericValue = rapidjson::GenericValue<rapidjson::UTF8<>>
using JsonAllocator = rapidjson::MemoryPoolAllocator

Functions

template<typename T>
void addMember(JsonGenericValue& value, rapidjson::GenericStringRef<char> name, const T& obj, JsonAllocator& allocator)
template<typename T>
auto readMember(const JsonGenericValue& value, const char* name, T& x) -> bool
auto toJsonValue(bool x, JsonAllocator&) -> JsonGenericValue
auto toJsonValue(int x, JsonAllocator&) -> JsonGenericValue
auto toJsonValue(unsigned x, JsonAllocator&) -> JsonGenericValue
auto toJsonValue(int64_t x, JsonAllocator&) -> JsonGenericValue
auto toJsonValue(uint64_t x, JsonAllocator&) -> JsonGenericValue
auto toJsonValue(double x, JsonAllocator&) -> JsonGenericValue
auto toJsonValue(float x, JsonAllocator&) -> JsonGenericValue
auto fromJsonValue(const JsonGenericValue& obj, bool& val) -> bool
Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.
auto fromJsonValue(const JsonGenericValue& obj, int& val) -> bool
Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.
auto fromJsonValue(const JsonGenericValue& obj, unsigned& val) -> bool
Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.
auto fromJsonValue(const JsonGenericValue& obj, int64_t& val) -> bool
Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.
auto fromJsonValue(const JsonGenericValue& obj, uint64_t& val) -> bool
Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.
auto fromJsonValue(const JsonGenericValue& obj, double& val) -> bool
Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.
auto fromJsonValue(const JsonGenericValue& obj, float& val) -> bool
Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.
template<typename T>
void addMemberAsUint32(JsonGenericValue& value, const rapidjson::GenericStringRef<char>& name, const T& x, JsonAllocator& allocator)
template<typename T>
auto readMemberAsUint32(const JsonGenericValue& value, const char* name, T& x) -> bool
template<typename T>
auto toJsonArrayHelper(const T* objects, int count, JsonAllocator& allocator) -> JsonGenericValue
Helper to convert an array of objects to a json array object.
void addMember(JsonGenericValue& value, const rapidjson::GenericStringRef<char>& name, JsonGenericValue& child, JsonAllocator& allocator)
void addMember(JsonGenericValue& value, const rapidjson::GenericStringRef<char>& name, JsonGenericValue&& child, JsonAllocator& allocator)

Function documentation

bool fromJsonValue(const JsonGenericValue& obj, bool& val)

Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.

Parameters
obj string tag to look for in json doc
val destination value to be populated
Returns whether successful or not

bool fromJsonValue(const JsonGenericValue& obj, int& val)

Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.

Parameters
obj string tag to look for in json doc
val destination value to be populated
Returns whether successful or not

bool fromJsonValue(const JsonGenericValue& obj, unsigned& val)

Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.

Parameters
obj string tag to look for in json doc
val destination value to be populated
Returns whether successful or not

bool fromJsonValue(const JsonGenericValue& obj, int64_t& val)

Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.

Parameters
obj string tag to look for in json doc
val destination value to be populated
Returns whether successful or not

bool fromJsonValue(const JsonGenericValue& obj, uint64_t& val)

Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.

Parameters
obj string tag to look for in json doc
val destination value to be populated
Returns whether successful or not

bool fromJsonValue(const JsonGenericValue& obj, double& val)

Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.

Parameters
obj string tag to look for in json doc
val destination value to be populated
Returns whether successful or not

bool fromJsonValue(const JsonGenericValue& obj, float& val)

Populate passed val with value. Returns whether successfully populated, or not. Logs an error if inappropriate type.

Parameters
obj string tag to look for in json doc
val destination value to be populated
Returns whether successful or not