1#ifndef TENDUKE_JSON_JSONUTILS_H
2#define TENDUKE_JSON_JSONUTILS_H
4#include "./JSONArray.h"
5#include "./JSONElement.h"
6#include "./JSONNumber.h"
7#include "./JSONObject.h"
79std::int64_t
toInt64(
const JSONElement * element,
bool throwIfInvalid =
true, std::int64_t defaultValue = 0);
91std::int64_t
toInt64(
const JSONElement & element,
bool throwIfInvalid =
true, std::int64_t defaultValue = 0);
204std::string getStdString(
const tenduke::json::JSONObject *
object,
const std::string &propertyName,
const std::string &defaultValue = {});
A JSON array.
Definition JSONArray.h:16
Superclass of JSON elements.
Definition JSONElement.h:12
Represents JSON number.
Definition JSONNumber.h:12
JSON object element.
Definition JSONObject.h:16
JSON support.
Definition JSONArray.h:10
std::int64_t toInt64(const JSONElement *element, bool throwIfInvalid=true, std::int64_t defaultValue=0)
Returns given element as std::int_64t, assuming the element is JSONNumber.
Definition JSONUtils.cpp:67
std::string getStdString(const tenduke::json::JSONObject &object, const std::string &propertyName, const std::string &defaultValue={})
Helper to get JSON object property as std::string.
Definition JSONUtils.cpp:177
tenduke::json::JSONArray * castToArray(tenduke::json::JSONElement *element)
Type-casts given element to JSONArray.
Definition JSONUtils.cpp:10
tenduke::json::JSONObject * castToObject(tenduke::json::JSONElement *element)
Type-casts given element to JSONObject.
Definition JSONUtils.cpp:34
tenduke::json::JSONArray * getArray(const json::JSONObject *object, const std::string &propertyName)
Helper to get JSON object property as tenduke::json::JSONArray.
Definition JSONUtils.cpp:140
bool getBool(const json::JSONObject *object, const std::string &propertyName, bool defaultValue=false)
Helper to get JSON object property as boolean.
Definition JSONUtils.cpp:83
tenduke::json::JSONObject * getObject(const tenduke::json::JSONObject *object, const std::string &propertyName)
Helper to get JSON object property as tenduke::json::JSONObject.
Definition JSONUtils.cpp:158
std::int64_t getInt64(const tenduke::json::JSONObject *object, const std::string &propertyName, std::int64_t defaultValue=0)
Helper to get numeric JSON object property as std::int64_t.
Definition JSONUtils.cpp:108
bool isBooleanTrue(const JSONElement *element)
Returns true if element is JSONBoolean with value true.
Definition JSONUtils.cpp:204
std::int32_t getInt32(const tenduke::json::JSONObject *object, const std::string &propertyName, std::int32_t defaultValue=0)
Helper to get numeric JSON object property as std::int32_t.
Definition JSONUtils.cpp:95
tenduke::json::JSONNumber * getNumber(const tenduke::json::JSONObject *object, const std::string &propertyName)
Helper to get JSON object property as tenduke::json::JSONNumber.
Definition JSONUtils.cpp:121
Root for classes, functions and globals of 10Duke C++ Client.
Definition BackendConfiguration.h:7