49#include "common/array.h"
50#include "common/hashmap.h"
51#include "common/hash-str.h"
52#include "common/memstream.h"
53#include "common/str.h"
56#if (defined(WIN32) && !defined(__GNUC__))
57static inline bool isnan(
double x) {
61static inline bool isinf(
double x) {
62 return !isnan(x) && isnan(x - x);
67static inline bool simplejson_wcsnlen(
const char *s,
size_t n) {
73 if (*(save++) == 0)
return false;
83typedef Array<JSONValue*> JSONArray;
84typedef HashMap<String, JSONValue*> JSONObject;
88enum JSONType { JSONType_Null, JSONType_String, JSONType_Bool, JSONType_Number, JSONType_IntegerNumber, JSONType_Array, JSONType_Object };
106 bool isString()
const;
108 bool isNumber()
const;
109 bool isIntegerNumber()
const;
110 bool isArray()
const;
111 bool isObject()
const;
113 const String &asString()
const;
115 double asNumber()
const;
116 long long int asIntegerNumber()
const;
120 size_t countChildren()
const;
121 bool hasChild(
size_t index)
const;
123 bool hasChild(
const char *name)
const;
127 String stringify(
bool const prettyprint =
false)
const;
129 static JSONValue *parse(
const char **data);
133 static uint32 decodeUtf8Char(String::const_iterator &begin,
const String::const_iterator &end);
134 static uint8 decodeUtf8Byte(uint8 state, uint32 &codepoint, uint8
byte);
135 String stringifyImpl(
size_t const indentDepth)
const;
136 static String indent(
size_t depth);
143 long long int _integerValue;
159 return parse(data.c_str());
161 static JSONValue *parse(
const char *data);
164 static bool skipWhitespace(
const char **data);
165 static bool extractString(
const char **data,
String &str);
166 static uint32 parseUnicode(
const char **data);
167 static double parseInt(
const char **data);
168 static double parseDecimal(
const char **data);
static char * zeroTerminateContents(Common::MemoryWriteStreamDynamic &stream)
Definition: memstream.h:194
Definition: algorithm.h:29