10#ifndef WX_JSONREADER_H
11#define WX_JSONREADER_H
29 wxJSONREADER_STRICT = 0,
30 wxJSONREADER_ALLOW_COMMENTS = 1,
31 wxJSONREADER_STORE_COMMENTS = 2,
32 wxJSONREADER_CASE = 4,
33 wxJSONREADER_MISSING = 8,
34 wxJSONREADER_MULTISTRING = 16,
35 wxJSONREADER_COMMENTS_AFTER = 32,
36 wxJSONREADER_NOUTF8_STREAM = 64,
37 wxJSONREADER_MEMORYBUFF = 128,
39 wxJSONREADER_TOLERANT = wxJSONREADER_ALLOW_COMMENTS | wxJSONREADER_CASE |
40 wxJSONREADER_MISSING | wxJSONREADER_MULTISTRING,
41 wxJSONREADER_COMMENTS_BEFORE =
42 wxJSONREADER_ALLOW_COMMENTS | wxJSONREADER_STORE_COMMENTS
47 wxJSONReader(
int flags = wxJSONREADER_TOLERANT,
int maxErrors = 30);
61#if defined(wxJSON_64BIT_INT)
62 static bool Strtoll(
const wxString& str, wxInt64* i64);
63 static bool Strtoull(
const wxString& str, wxUint64* ui64);
64 static bool DoStrto_ll(
const wxString& str, wxUint64* ui64, wxChar* sign);
69 void AddError(
const wxString& descr);
70 void AddError(
const wxString& fmt,
const wxString& str);
71 void AddError(
const wxString& fmt, wxChar ch);
72 void AddWarning(
int type,
const wxString& descr);
82 int ReadToken(wxInputStream& is,
int ch, wxString& s);
84 int ReadUES(wxInputStream& is,
char* uesBuffer);
85 int AppendUES(wxMemoryBuffer& utf8Buff,
const char* uesBuffer);
int m_colNo
The current column number (start at 1).
int ReadToken(wxInputStream &is, int ch, wxString &s)
Reads a token string.
int DoRead(wxInputStream &doc, wxJSONValue &val)
Reads the JSON text document (internal use).
void AddWarning(int type, const wxString &descr)
Add a warning message to the warning's array.
int ConvertCharByChar(wxString &s, const wxMemoryBuffer &utf8Buffer)
Convert a UTF-8 memory buffer one char at a time.
int m_maxErrors
Maximum number of errors stored in the error's array.
bool m_noUtf8
ANSI: do not convert UTF-8 strings.
wxJSONValue * m_lastStored
The pointer to the value object that was last stored.
int AppendUES(wxMemoryBuffer &utf8Buff, const char *uesBuffer)
The function appends a Unice Escaped Sequence to the temporary UTF8 buffer.
int ReadChar(wxInputStream &is)
Read a character from the input JSON document.
int SkipComment(wxInputStream &is)
Skip a comment.
int ReadString(wxInputStream &is, wxJSONValue &val)
Read a string value.
int m_flags
Flag that control the parser behaviour,.
int ReadUES(wxInputStream &is, char *uesBuffer)
Read a 4-hex-digit unicode character.
wxJSONReader(int flags=wxJSONREADER_TOLERANT, int maxErrors=30)
Ctor.
void StoreComment(const wxJSONValue *parent)
Store the comment string in the value it refers to.
static int UTF8NumBytes(char ch)
Compute the number of bytes that makes a UTF-8 encoded wide character.
int m_lineNo
The current line number (start at 1).
int GetDepth() const
Return the depth of the JSON input text.
int m_commentLine
The starting line of the comment string.
int m_depth
The depth level of the read JSON text.
wxJSONValue * m_current
The pointer to the value object that is being read.
int m_level
The current level of object/array annidation (start at ZERO).
void StoreValue(int ch, const wxString &key, wxJSONValue &value, wxJSONValue &parent)
Store a value in the parent object.
const wxArrayString & GetWarnings() const
Return a reference to the warning message's array.
const wxArrayString & GetErrors() const
Return a reference to the error message's array.
wxArrayString m_errors
The array of error messages.
wxArrayString m_warnings
The array of warning messages.
int GetErrorCount() const
Return the size of the error message's array.
void AddError(const wxString &descr)
Add a error message to the error's array.
wxJSONValue * m_next
The pointer to the value object that will be read.
int GetWarningCount() const
Return the size of the warning message's array.
wxString m_comment
The comment string read by SkipComment().
int ReadValue(wxInputStream &is, int ch, wxJSONValue &val)
Read a value from input stream.
int Parse(const wxString &doc, wxJSONValue *val)
Parse the JSON document.
int ReadMemoryBuff(wxInputStream &is, wxJSONValue &val)
Read a memory buffer type.
int GetStart(wxInputStream &is)
Returns the start of the document.
int NumBytes(char ch)
Return the number of bytes that make a character in stream input.
int SkipWhiteSpace(wxInputStream &is)
Skip all whitespaces.
int m_peekChar
The character read by the PeekChar() function (-1 none).
int PeekChar(wxInputStream &is)
Peek a character from the input JSON document.
The JSON value class implementation.
JSON Configuration System Definitions.