28 #include <AtomsUtils/Globals.h>
46 #if defined(__APPLE__) && __DARWIN_C_LEVEL < 200809L || (defined(WIN32) && defined(__GNUC__)) || defined(ANDROID)
50 static inline int wcsncasecmp(
const wchar_t *s1,
const wchar_t *s2,
size_t n)
75 static inline bool simplejson_wcsnlen(
const wchar_t *s,
size_t n) {
79 const wchar_t *save = s;
82 if (*(save++) == 0)
return false;
88 class ATOMSUTILS_EXPORT JSON;
89 class ATOMSUTILS_EXPORT JSONValue;
90 typedef std::vector<JSONValue*> JSONArray;
91 typedef std::map<std::wstring, JSONValue*> JSONObject;
94 enum JSONType { JSONType_Null, JSONType_String, JSONType_Bool, JSONType_Number, JSONType_Array, JSONType_Object };
103 JSONValue(
const std::wstring &m_string_value);
106 JSONValue(
const JSONArray &m_array_value);
107 JSONValue(
const JSONObject &m_object_value);
112 bool IsString()
const;
114 bool IsNumber()
const;
115 bool IsArray()
const;
116 bool IsObject()
const;
118 const std::wstring &AsString()
const;
120 double AsNumber()
const;
121 const JSONArray &AsArray()
const;
122 const JSONObject &AsObject()
const;
124 std::size_t CountChildren()
const;
125 bool HasChild(std::size_t index)
const;
127 bool HasChild(
const wchar_t* name)
const;
129 std::vector<std::wstring> ObjectKeys()
const;
131 std::wstring Stringify(
bool const prettyprint =
false)
const;
133 static JSONValue *Parse(
const wchar_t **data);
136 static std::wstring StringifyString(
const std::wstring &str);
137 std::wstring StringifyImpl(
size_t const indentDepth)
const;
138 static std::wstring Indent(
size_t depth);
146 std::wstring *string_value;
147 JSONArray *array_value;
148 JSONObject *object_value;
158 static JSONValue* Parse(
const char *data);
159 static JSONValue* Parse(
const wchar_t *data);
160 static std::wstring Stringify(
const JSONValue *value);
162 static bool SkipWhitespace(
const wchar_t **data);
163 static bool ExtractString(
const wchar_t **data, std::wstring &str);
164 static double ParseInt(
const wchar_t **data);
165 static double ParseDecimal(
const wchar_t **data);
AtomsCore namespace.
Definition: Base64.h:13