11 #if !defined( _WX_JSONREADER_H )
12 #define _WX_JSONREADER_H
15 #pragma interface "jsonreader.h"
19 #include "wx/wxprec.h"
28 #include <wx/stream.h>
29 #include <wx/string.h>
30 #include <wx/arrstr.h>
34 #include "json_defs.h"
39 wxJSONREADER_STRICT = 0,
40 wxJSONREADER_ALLOW_COMMENTS = 1,
41 wxJSONREADER_STORE_COMMENTS = 2,
42 wxJSONREADER_CASE = 4,
43 wxJSONREADER_MISSING = 8,
44 wxJSONREADER_MULTISTRING = 16,
45 wxJSONREADER_COMMENTS_AFTER = 32,
46 wxJSONREADER_NOUTF8_STREAM = 64,
47 wxJSONREADER_MEMORYBUFF = 128,
49 wxJSONREADER_TOLERANT = wxJSONREADER_ALLOW_COMMENTS | wxJSONREADER_CASE |
50 wxJSONREADER_MISSING | wxJSONREADER_MULTISTRING,
51 wxJSONREADER_COMMENTS_BEFORE = wxJSONREADER_ALLOW_COMMENTS | wxJSONREADER_STORE_COMMENTS
58 wxJSONReader(
int flags = wxJSONREADER_TOLERANT,
int maxErrors = 30 );
65 int GetErrorCount()
const;
66 int GetWarningCount()
const;
67 const wxArrayString& GetErrors()
const;
68 const wxArrayString& GetWarnings()
const;
70 static int UTF8NumBytes(
char ch );
72 #if defined( wxJSON_64BIT_INT )
73 static bool Strtoll(
const wxString& str, wxInt64* i64 );
74 static bool Strtoull(
const wxString& str, wxUint64* ui64 );
75 static bool DoStrto_ll(
const wxString& str, wxUint64* ui64, wxChar* sign );
81 void AddError(
const wxString& descr );
82 void AddError(
const wxString& fmt,
const wxString& str );
83 void AddError(
const wxString& fmt, wxChar ch );
84 void AddWarning(
int type,
const wxString& descr );
85 int GetStart( wxInputStream& is );
86 int ReadChar( wxInputStream& is );
87 int PeekChar( wxInputStream& is );
89 int SkipWhiteSpace( wxInputStream& is );
90 int SkipComment( wxInputStream& is );
92 int ReadString( wxInputStream& is,
wxJSONValue& val );
93 int ReadToken( wxInputStream& is,
int ch, wxString& s );
94 int ReadValue( wxInputStream& is,
int ch,
wxJSONValue& val );
95 int ReadUES( wxInputStream& is,
char* uesBuffer );
96 int AppendUES( wxMemoryBuffer& utf8Buff,
const char* uesBuffer );
97 int NumBytes(
char ch );
98 int ConvertCharByChar( wxString& s,
const wxMemoryBuffer& utf8Buffer );
99 int ReadMemoryBuff( wxInputStream& is,
wxJSONValue& val );
148 #endif // not defined _WX_JSONREADER_H
wxJSONValue * m_lastStored
The pointer to the value object that was last stored.
Definition: jsonreader.h:123
int m_peekChar
The character read by the PeekChar() function (-1 none)
Definition: jsonreader.h:141
wxArrayString m_warnings
The array of warning messages.
Definition: jsonreader.h:138
int m_commentLine
The starting line of the comment string.
Definition: jsonreader.h:132
The JSON value class implementation.
Definition: jsonval.h:91
wxJSONValue * m_current
The pointer to the value object that is being read.
Definition: jsonreader.h:120
int m_lineNo
The current line number (start at 1).
Definition: jsonreader.h:108
bool m_noUtf8
ANSI: do not convert UTF-8 strings.
Definition: jsonreader.h:144
wxJSONValue * m_next
The pointer to the value object that will be read.
Definition: jsonreader.h:126
wxArrayString m_errors
The array of error messages.
Definition: jsonreader.h:135
int m_colNo
The current column number (start at 1).
Definition: jsonreader.h:111
int m_depth
The depth level of the read JSON text.
Definition: jsonreader.h:117
int m_flags
Flag that control the parser behaviour,.
Definition: jsonreader.h:102
int m_level
The current level of object/array annidation (start at ZERO).
Definition: jsonreader.h:114
The JSON parser.
Definition: jsonreader.h:55
int m_maxErrors
Maximum number of errors stored in the error's array.
Definition: jsonreader.h:105
wxString m_comment
The comment string read by SkipComment().
Definition: jsonreader.h:129