20#include <wx/hashmap.h>
21#include <wx/dynarray.h>
31#if defined(wxJSON_USE_STL)
35WX_DECLARE_OBJARRAY(
wxJSONValue, wxJSONInternalArray);
36WX_DECLARE_STRING_HASH_MAP(
wxJSONValue, wxJSONInternalMap);
38class WXDLLIMPEXP_JSON wxJSONInternalMap;
39class WXDLLIMPEXP_JSON wxJSONInternalArray;
44 wxJSONTYPE_INVALID = 0,
66 wxJSONVALUE_COMMENT_DEFAULT = 0,
67 wxJSONVALUE_COMMENT_BEFORE,
68 wxJSONVALUE_COMMENT_AFTER,
69 wxJSONVALUE_COMMENT_INLINE,
92#if defined(wxJSON_64BIT_INT)
106 wxJSONType GetType()
const;
107 bool IsValid()
const;
111 bool IsShort()
const;
112 bool IsUShort()
const;
114 bool IsULong()
const;
115#if defined(wxJSON_64BIT_INT)
116 bool IsInt32()
const;
117 bool IsInt64()
const;
118 bool IsUInt32()
const;
119 bool IsUInt64()
const;
122 bool IsDouble()
const;
123 bool IsString()
const;
124 bool IsCString()
const;
125 bool IsArray()
const;
126 bool IsObject()
const;
127 bool IsMemoryBuff()
const;
131 unsigned int AsUInt()
const;
132 short AsShort()
const;
133 unsigned short AsUShort()
const;
134 long int AsLong()
const;
135 unsigned long AsULong()
const;
136 bool AsInt(
int& i)
const;
137 bool AsUInt(
unsigned int& ui)
const;
138 bool AsShort(
short int& s)
const;
139 bool AsUShort(
unsigned short& us)
const;
140 bool AsLong(
long int& l)
const;
141 bool AsULong(
unsigned long& ul)
const;
142#if defined(wxJSON_64BIT_INT)
143 wxInt32 AsInt32()
const;
144 wxUint32 AsUInt32()
const;
145 wxInt64 AsInt64()
const;
146 wxUint64 AsUInt64()
const;
147 bool AsInt32(wxInt32& i32)
const;
148 bool AsUInt32(wxUint32& ui32)
const;
149 bool AsInt64(wxInt64& i64)
const;
150 bool AsUInt64(wxUint64& ui64)
const;
153 double AsDouble()
const;
154 wxString AsString()
const;
155 const wxChar* AsCString()
const;
156 bool AsBool(
bool& b)
const;
157 bool AsDouble(
double& d)
const;
158 bool AsString(wxString& str)
const;
159 bool AsCString(wxChar* ch)
const;
160 wxMemoryBuffer AsMemoryBuff()
const;
161 bool AsMemoryBuff(wxMemoryBuffer& buff)
const;
163 const wxJSONInternalMap* AsMap()
const;
164 const wxJSONInternalArray* AsArray()
const;
167 bool HasMember(
unsigned index)
const;
168 bool HasMember(
const wxString& key)
const;
170 wxArrayString GetMemberNames()
const;
181#if defined(wxJSON_64BIT_INT)
190 bool Remove(
int index);
191 bool Remove(
const wxString& key);
193 bool Cat(
const wxChar* str);
194 bool Cat(
const wxString& str);
195 bool Cat(
const wxMemoryBuffer& buff);
212#if defined(wxJSON_64BIT_INT)
220 wxJSONValue& operator=(
const wxMemoryBuffer& buff);
232 int AddComment(
const wxString& str,
233 int position = wxJSONVALUE_COMMENT_DEFAULT);
234 int AddComment(
const wxArrayString& comments,
235 int position = wxJSONVALUE_COMMENT_DEFAULT);
236 wxString GetComment(
int idx = -1)
const;
237 int GetCommentPos()
const;
238 int GetCommentCount()
const;
239 void ClearComments();
240 const wxArrayString& GetCommentArray()
const;
243 wxString GetInfo()
const;
244 wxString Dump(
bool deep =
false,
int mode = 0)
const;
249 int GetLineNo()
const;
250 void SetLineNo(
int num);
253 static wxString TypeToString(wxJSONType type);
254 static wxString MemoryBuffToString(
const wxMemoryBuffer& buff,
256 static wxString MemoryBuffToString(
const void* buff,
size_t len,
257 size_t actualLen = -1);
258 static int CompareMemoryBuff(
const wxMemoryBuffer& buff1,
259 const wxMemoryBuffer& buff2);
260 static int CompareMemoryBuff(
const wxMemoryBuffer& buff1,
const void* buff2);
261 static wxMemoryBuffer ArrayToMemoryBuff(
const wxJSONValue& value);
279 void AllocExclusive();
285#if defined(WXJSON_USE_VALUE_COUNTER)
291#if !defined(wxJSON_USE_STL)
294WX_DECLARE_OBJARRAY(
wxJSONValue, wxJSONInternalArray);
295WX_DECLARE_STRING_HASH_MAP(
wxJSONValue, wxJSONInternalMap);
317 unsigned int m_valUInt;
318 short int m_valShort;
319 unsigned short m_valUShort;
321 unsigned long m_valULong;
323 const wxChar* m_valCString;
325#if defined(wxJSON_64BIT_INT)
327 wxUint64 m_valUInt64;
336#if defined(wxJSON_64BIT_INT)
337#define VAL_INT m_valInt64
338#define VAL_UINT m_valUInt64
340#define VAL_INT m_valLong
341#define VAL_UINT m_valULong
354 int GetRefCount()
const;
413#if defined(WXJSON_USE_VALUE_COUNTER)
The reference counted JSON value data (internal use).
wxMemoryBuffer * m_memBuff
The pointer to the memory buffer object.
wxJSONInternalMap m_valMap
The JSON object value.
int m_commentPos
The position of the comment line(s), if any.
int m_refCount
the references count
wxJSONInternalArray m_valArray
The JSON array value.
wxJSONType m_type
The actual type of the value held by this object.
int m_lineNo
The line number when this value was read.
wxString m_valString
The JSON string value.
wxJSONValueHolder m_value
The JSON value held by this object.
wxArrayString m_comments
The array of comment lines; may be empty.
The JSON value class implementation.
wxJSONRefData * m_refData
the referenced data
The JSON document writer.
The actual value held by the wxJSONValue class (internal use)