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" 
   22tenduke::json::JSONArray * 
castToArray(tenduke::json::JSONElement *element);
 
   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);
 
  215std::vector<std::string> 
toArrayOfStrings(const ::tenduke::json::JSONArray * array);
 
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:66
 
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:176
 
tenduke::json::JSONArray * castToArray(tenduke::json::JSONElement *element)
Type-casts given element to JSONArray.
Definition JSONUtils.cpp:9
 
std::vector< std::string > toArrayOfStrings(const ::tenduke::json::JSONArray *array)
Converts a tenduke::json::JSONArray to a flattened vector of strings.
Definition JSONUtils.cpp:223
 
std::map< std::string, std::string > toMapOfStrings(const tenduke::json::JSONObject *object)
Converts a tenduke::json::JSONObject to a flattened map of strings, where the key is name of the obje...
Definition JSONUtils.cpp:236
 
tenduke::json::JSONObject * castToObject(tenduke::json::JSONElement *element)
Type-casts given element to JSONObject.
Definition JSONUtils.cpp:33
 
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:139
 
bool getBool(const json::JSONObject *object, const std::string &propertyName, bool defaultValue=false)
Helper to get JSON object property as boolean.
Definition JSONUtils.cpp:82
 
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:157
 
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:107
 
bool isBooleanTrue(const JSONElement *element)
Returns true if element is JSONBoolean with value true.
Definition JSONUtils.cpp:203
 
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:94
 
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:120
 
Root for classes, functions and globals of 10Duke C++ Client.
Definition APIRequest.h:4