10#if !defined(_WX_JSONVAL_H)
14#pragma interface "jsonval.h"
21#include <wx/hashmap.h>
22#include <wx/dynarray.h>
32#if defined(wxJSON_USE_STL)
36WX_DECLARE_OBJARRAY(
wxJSONValue, wxJSONInternalArray);
37WX_DECLARE_STRING_HASH_MAP(
wxJSONValue, wxJSONInternalMap);
39class WXDLLIMPEXP_JSON wxJSONInternalMap;
40class WXDLLIMPEXP_JSON wxJSONInternalArray;
45 wxJSONTYPE_INVALID = 0,
67 wxJSONVALUE_COMMENT_DEFAULT = 0,
68 wxJSONVALUE_COMMENT_BEFORE,
69 wxJSONVALUE_COMMENT_AFTER,
70 wxJSONVALUE_COMMENT_INLINE,
93#if defined(wxJSON_64BIT_INT)
107 wxJSONType GetType()
const;
108 bool IsValid()
const;
112 bool IsShort()
const;
113 bool IsUShort()
const;
115 bool IsULong()
const;
116#if defined(wxJSON_64BIT_INT)
117 bool IsInt32()
const;
118 bool IsInt64()
const;
119 bool IsUInt32()
const;
120 bool IsUInt64()
const;
123 bool IsDouble()
const;
124 bool IsString()
const;
125 bool IsCString()
const;
126 bool IsArray()
const;
127 bool IsObject()
const;
128 bool IsMemoryBuff()
const;
132 unsigned int AsUInt()
const;
133 short AsShort()
const;
134 unsigned short AsUShort()
const;
135 long int AsLong()
const;
136 unsigned long AsULong()
const;
137 bool AsInt(
int& i)
const;
138 bool AsUInt(
unsigned int& ui)
const;
139 bool AsShort(
short int& s)
const;
140 bool AsUShort(
unsigned short& us)
const;
141 bool AsLong(
long int& l)
const;
142 bool AsULong(
unsigned long& ul)
const;
143#if defined(wxJSON_64BIT_INT)
144 wxInt32 AsInt32()
const;
145 wxUint32 AsUInt32()
const;
146 wxInt64 AsInt64()
const;
147 wxUint64 AsUInt64()
const;
148 bool AsInt32(wxInt32& i32)
const;
149 bool AsUInt32(wxUint32& ui32)
const;
150 bool AsInt64(wxInt64& i64)
const;
151 bool AsUInt64(wxUint64& ui64)
const;
154 double AsDouble()
const;
155 wxString AsString()
const;
156 const wxChar* AsCString()
const;
157 bool AsBool(
bool& b)
const;
158 bool AsDouble(
double& d)
const;
159 bool AsString(wxString& str)
const;
160 bool AsCString(wxChar* ch)
const;
161 wxMemoryBuffer AsMemoryBuff()
const;
162 bool AsMemoryBuff(wxMemoryBuffer& buff)
const;
164 const wxJSONInternalMap* AsMap()
const;
165 const wxJSONInternalArray* AsArray()
const;
168 bool HasMember(
unsigned index)
const;
169 bool HasMember(
const wxString& key)
const;
171 wxArrayString GetMemberNames()
const;
182#if defined(wxJSON_64BIT_INT)
192 bool Remove(
const wxString& key);
194 bool Cat(
const wxChar* str);
195 bool Cat(
const wxString& str);
196 bool Cat(
const wxMemoryBuffer& buff);
213#if defined(wxJSON_64BIT_INT)
221 wxJSONValue& operator=(
const wxMemoryBuffer& buff);
233 int AddComment(
const wxString& str,
234 int position = wxJSONVALUE_COMMENT_DEFAULT);
235 int AddComment(
const wxArrayString& comments,
236 int position = wxJSONVALUE_COMMENT_DEFAULT);
237 wxString GetComment(
int idx = -1)
const;
238 int GetCommentPos()
const;
239 int GetCommentCount()
const;
240 void ClearComments();
241 const wxArrayString& GetCommentArray()
const;
244 wxString GetInfo()
const;
245 wxString Dump(
bool deep =
false,
int mode = 0)
const;
250 int GetLineNo()
const;
251 void SetLineNo(
int num);
254 static wxString TypeToString(wxJSONType type);
255 static wxString MemoryBuffToString(
const wxMemoryBuffer& buff,
257 static wxString MemoryBuffToString(
const void* buff,
size_t len,
258 size_t actualLen = -1);
259 static int CompareMemoryBuff(
const wxMemoryBuffer& buff1,
260 const wxMemoryBuffer& buff2);
261 static int CompareMemoryBuff(
const wxMemoryBuffer& buff1,
const void* buff2);
262 static wxMemoryBuffer ArrayToMemoryBuff(
const wxJSONValue& value);
280 void AllocExclusive();
286#if defined(WXJSON_USE_VALUE_COUNTER)
292#if !defined(wxJSON_USE_STL)
295WX_DECLARE_OBJARRAY(
wxJSONValue, wxJSONInternalArray);
296WX_DECLARE_STRING_HASH_MAP(
wxJSONValue, wxJSONInternalMap);
318 unsigned int m_valUInt;
319 short int m_valShort;
320 unsigned short m_valUShort;
322 unsigned long m_valULong;
324 const wxChar* m_valCString;
326#if defined(wxJSON_64BIT_INT)
328 wxUint64 m_valUInt64;
337#if defined(wxJSON_64BIT_INT)
338#define VAL_INT m_valInt64
339#define VAL_UINT m_valUInt64
341#define VAL_INT m_valLong
342#define VAL_UINT m_valULong
355 int GetRefCount()
const;
375 wxString m_valString;
378 wxJSONInternalArray m_valArray;
381 wxJSONInternalMap m_valMap;
393 wxArrayString m_comments;
411 wxMemoryBuffer* m_memBuff;
414#if defined(WXJSON_USE_VALUE_COUNTER)
The reference counted JSON value data (internal use).
The JSON value class implementation.
The JSON document writer.
bool Remove(const std::string &name)
Remove a filter, return ok if no errors.
The actual value held by the wxJSONValue class (internal use)