11#if !defined(_WX_JSONVAL_H)
15#pragma interface "jsonval.h"
29#include <wx/hashmap.h>
30#include <wx/dynarray.h>
40#if defined(wxJSON_USE_STL)
44WX_DECLARE_OBJARRAY(
wxJSONValue, wxJSONInternalArray);
45WX_DECLARE_STRING_HASH_MAP(
wxJSONValue, wxJSONInternalMap);
47class WXDLLIMPEXP_JSON wxJSONInternalMap;
48class WXDLLIMPEXP_JSON wxJSONInternalArray;
53 wxJSONTYPE_INVALID = 0,
75 wxJSONVALUE_COMMENT_DEFAULT = 0,
76 wxJSONVALUE_COMMENT_BEFORE,
77 wxJSONVALUE_COMMENT_AFTER,
78 wxJSONVALUE_COMMENT_INLINE,
101#if defined(wxJSON_64BIT_INT)
115 wxJSONType GetType()
const;
116 bool IsValid()
const;
120 bool IsShort()
const;
121 bool IsUShort()
const;
123 bool IsULong()
const;
124#if defined(wxJSON_64BIT_INT)
125 bool IsInt32()
const;
126 bool IsInt64()
const;
127 bool IsUInt32()
const;
128 bool IsUInt64()
const;
131 bool IsDouble()
const;
132 bool IsString()
const;
133 bool IsCString()
const;
134 bool IsArray()
const;
135 bool IsObject()
const;
136 bool IsMemoryBuff()
const;
140 unsigned int AsUInt()
const;
141 short AsShort()
const;
142 unsigned short AsUShort()
const;
143 long int AsLong()
const;
144 unsigned long AsULong()
const;
145 bool AsInt(
int& i)
const;
146 bool AsUInt(
unsigned int& ui)
const;
147 bool AsShort(
short int& s)
const;
148 bool AsUShort(
unsigned short& us)
const;
149 bool AsLong(
long int& l)
const;
150 bool AsULong(
unsigned long& ul)
const;
151#if defined(wxJSON_64BIT_INT)
152 wxInt32 AsInt32()
const;
153 wxUint32 AsUInt32()
const;
154 wxInt64 AsInt64()
const;
155 wxUint64 AsUInt64()
const;
156 bool AsInt32(wxInt32& i32)
const;
157 bool AsUInt32(wxUint32& ui32)
const;
158 bool AsInt64(wxInt64& i64)
const;
159 bool AsUInt64(wxUint64& ui64)
const;
162 double AsDouble()
const;
163 wxString AsString()
const;
164 const wxChar* AsCString()
const;
165 bool AsBool(
bool& b)
const;
166 bool AsDouble(
double& d)
const;
167 bool AsString(wxString& str)
const;
168 bool AsCString(wxChar* ch)
const;
169 wxMemoryBuffer AsMemoryBuff()
const;
170 bool AsMemoryBuff(wxMemoryBuffer& buff)
const;
172 const wxJSONInternalMap* AsMap()
const;
173 const wxJSONInternalArray* AsArray()
const;
176 bool HasMember(
unsigned index)
const;
177 bool HasMember(
const wxString& key)
const;
179 wxArrayString GetMemberNames()
const;
190#if defined(wxJSON_64BIT_INT)
199 bool Remove(
int index);
200 bool Remove(
const wxString& key);
202 bool Cat(
const wxChar* str);
203 bool Cat(
const wxString& str);
204 bool Cat(
const wxMemoryBuffer& buff);
221#if defined(wxJSON_64BIT_INT)
229 wxJSONValue& operator=(
const wxMemoryBuffer& buff);
241 int AddComment(
const wxString& str,
242 int position = wxJSONVALUE_COMMENT_DEFAULT);
243 int AddComment(
const wxArrayString& comments,
244 int position = wxJSONVALUE_COMMENT_DEFAULT);
245 wxString GetComment(
int idx = -1)
const;
246 int GetCommentPos()
const;
247 int GetCommentCount()
const;
248 void ClearComments();
249 const wxArrayString& GetCommentArray()
const;
252 wxString GetInfo()
const;
253 wxString Dump(
bool deep =
false,
int mode = 0)
const;
258 int GetLineNo()
const;
259 void SetLineNo(
int num);
262 static wxString TypeToString(wxJSONType type);
263 static wxString MemoryBuffToString(
const wxMemoryBuffer& buff,
265 static wxString MemoryBuffToString(
const void* buff,
size_t len,
266 size_t actualLen = -1);
267 static int CompareMemoryBuff(
const wxMemoryBuffer& buff1,
268 const wxMemoryBuffer& buff2);
269 static int CompareMemoryBuff(
const wxMemoryBuffer& buff1,
const void* buff2);
270 static wxMemoryBuffer ArrayToMemoryBuff(
const wxJSONValue& value);
288 void AllocExclusive();
294#if defined(WXJSON_USE_VALUE_COUNTER)
300#if !defined(wxJSON_USE_STL)
303WX_DECLARE_OBJARRAY(
wxJSONValue, wxJSONInternalArray);
304WX_DECLARE_STRING_HASH_MAP(
wxJSONValue, wxJSONInternalMap);
326 unsigned int m_valUInt;
327 short int m_valShort;
328 unsigned short m_valUShort;
330 unsigned long m_valULong;
332 const wxChar* m_valCString;
334#if defined(wxJSON_64BIT_INT)
336 wxUint64 m_valUInt64;
345#if defined(wxJSON_64BIT_INT)
346#define VAL_INT m_valInt64
347#define VAL_UINT m_valUInt64
349#define VAL_INT m_valLong
350#define VAL_UINT m_valULong
363 int GetRefCount()
const;
383 wxString m_valString;
386 wxJSONInternalArray m_valArray;
389 wxJSONInternalMap m_valMap;
401 wxArrayString m_comments;
419 wxMemoryBuffer* m_memBuff;
422#if defined(WXJSON_USE_VALUE_COUNTER)
The reference counted JSON value data (internal use).
The JSON value class implementation.
The JSON document writer.
The actual value held by the wxJSONValue class (internal use)