Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qjsonparser.cpp File Reference

(cadc239c485ee4f1ab3587f3c53c548238c40fa5)

#include <qcoreapplication.h>
#include <qdebug.h>
#include "qjsonparser_p.h"
#include "qjson_p.h"
#include "private/qstringconverter_p.h"
#include "private/qcborvalue_p.h"
#include "private/qnumeric_p.h"
#include <private/qtools_p.h>
+ Include dependency graph for qjsonparser.cpp:

Go to the source code of this file.

Classes

class  StashedContainer
 

Macros

#define QT_PARSER_TRACING_BEGIN   QT_NO_QDEBUG_MACRO()
 
#define QT_PARSER_TRACING_END
 
#define QT_PARSER_TRACING_DEBUG   QT_NO_QDEBUG_MACRO()
 
#define JSONERR_OK   QT_TRANSLATE_NOOP("QJsonParseError", "no error occurred")
 
#define JSONERR_UNTERM_OBJ   QT_TRANSLATE_NOOP("QJsonParseError", "unterminated object")
 
#define JSONERR_MISS_NSEP   QT_TRANSLATE_NOOP("QJsonParseError", "missing name separator")
 
#define JSONERR_UNTERM_AR   QT_TRANSLATE_NOOP("QJsonParseError", "unterminated array")
 
#define JSONERR_MISS_VSEP   QT_TRANSLATE_NOOP("QJsonParseError", "missing value separator")
 
#define JSONERR_ILLEGAL_VAL   QT_TRANSLATE_NOOP("QJsonParseError", "illegal value")
 
#define JSONERR_END_OF_NUM   QT_TRANSLATE_NOOP("QJsonParseError", "invalid termination by number")
 
#define JSONERR_ILLEGAL_NUM   QT_TRANSLATE_NOOP("QJsonParseError", "illegal number")
 
#define JSONERR_STR_ESC_SEQ   QT_TRANSLATE_NOOP("QJsonParseError", "invalid escape sequence")
 
#define JSONERR_STR_UTF8   QT_TRANSLATE_NOOP("QJsonParseError", "invalid UTF8 string")
 
#define JSONERR_UTERM_STR   QT_TRANSLATE_NOOP("QJsonParseError", "unterminated string")
 
#define JSONERR_MISS_OBJ   QT_TRANSLATE_NOOP("QJsonParseError", "object is missing after a comma")
 
#define JSONERR_DEEP_NEST   QT_TRANSLATE_NOOP("QJsonParseError", "too deeply nested document")
 
#define JSONERR_DOC_LARGE   QT_TRANSLATE_NOOP("QJsonParseError", "too large document")
 
#define JSONERR_GARBAGEEND   QT_TRANSLATE_NOOP("QJsonParseError", "garbage at the end of the document")
 

Enumerations

enum  {
  Space = 0x20 , Tab = 0x09 , LineFeed = 0x0a , Return = 0x0d ,
  BeginArray = 0x5b , BeginObject = 0x7b , EndArray = 0x5d , EndObject = 0x7d ,
  NameSeparator = 0x3a , ValueSeparator = 0x2c , Quote = 0x22
}
 

Functions

template<typename Iterator , typename Compare , typename Assign >
static Iterator customAssigningUniqueLast (Iterator first, Iterator last, Compare compare, Assign assign)
 
static void sortContainer (QCborContainerPrivate *container)
 
static bool addHexDigit (char digit, char32_t *result)
 
static bool scanEscapeSequence (const char *&json, const char *end, char32_t *ch)
 
static bool scanUtf8Char (const char *&json, const char *end, char32_t *result)
 

Variables

static const int nestingLimit = 1024
 

Macro Definition Documentation

◆ JSONERR_DEEP_NEST

#define JSONERR_DEEP_NEST   QT_TRANSLATE_NOOP("QJsonParseError", "too deeply nested document")

Definition at line 51 of file qjsonparser.cpp.

Referenced by QJsonParseError::errorString().

◆ JSONERR_DOC_LARGE

#define JSONERR_DOC_LARGE   QT_TRANSLATE_NOOP("QJsonParseError", "too large document")

Definition at line 52 of file qjsonparser.cpp.

Referenced by QJsonParseError::errorString().

◆ JSONERR_END_OF_NUM

#define JSONERR_END_OF_NUM   QT_TRANSLATE_NOOP("QJsonParseError", "invalid termination by number")

Definition at line 45 of file qjsonparser.cpp.

Referenced by QJsonParseError::errorString().

◆ JSONERR_GARBAGEEND

#define JSONERR_GARBAGEEND   QT_TRANSLATE_NOOP("QJsonParseError", "garbage at the end of the document")

Definition at line 53 of file qjsonparser.cpp.

Referenced by QJsonParseError::errorString().

◆ JSONERR_ILLEGAL_NUM

#define JSONERR_ILLEGAL_NUM   QT_TRANSLATE_NOOP("QJsonParseError", "illegal number")

Definition at line 46 of file qjsonparser.cpp.

Referenced by QJsonParseError::errorString().

◆ JSONERR_ILLEGAL_VAL

#define JSONERR_ILLEGAL_VAL   QT_TRANSLATE_NOOP("QJsonParseError", "illegal value")

Definition at line 44 of file qjsonparser.cpp.

Referenced by QJsonParseError::errorString().

◆ JSONERR_MISS_NSEP

#define JSONERR_MISS_NSEP   QT_TRANSLATE_NOOP("QJsonParseError", "missing name separator")

Definition at line 41 of file qjsonparser.cpp.

Referenced by QJsonParseError::errorString().

◆ JSONERR_MISS_OBJ

#define JSONERR_MISS_OBJ   QT_TRANSLATE_NOOP("QJsonParseError", "object is missing after a comma")

Definition at line 50 of file qjsonparser.cpp.

Referenced by QJsonParseError::errorString().

◆ JSONERR_MISS_VSEP

#define JSONERR_MISS_VSEP   QT_TRANSLATE_NOOP("QJsonParseError", "missing value separator")

Definition at line 43 of file qjsonparser.cpp.

Referenced by QJsonParseError::errorString().

◆ JSONERR_OK

#define JSONERR_OK   QT_TRANSLATE_NOOP("QJsonParseError", "no error occurred")

Definition at line 39 of file qjsonparser.cpp.

Referenced by QJsonParseError::errorString().

◆ JSONERR_STR_ESC_SEQ

#define JSONERR_STR_ESC_SEQ   QT_TRANSLATE_NOOP("QJsonParseError", "invalid escape sequence")

Definition at line 47 of file qjsonparser.cpp.

Referenced by QJsonParseError::errorString().

◆ JSONERR_STR_UTF8

#define JSONERR_STR_UTF8   QT_TRANSLATE_NOOP("QJsonParseError", "invalid UTF8 string")

Definition at line 48 of file qjsonparser.cpp.

Referenced by QJsonParseError::errorString().

◆ JSONERR_UNTERM_AR

#define JSONERR_UNTERM_AR   QT_TRANSLATE_NOOP("QJsonParseError", "unterminated array")

Definition at line 42 of file qjsonparser.cpp.

Referenced by QJsonParseError::errorString().

◆ JSONERR_UNTERM_OBJ

#define JSONERR_UNTERM_OBJ   QT_TRANSLATE_NOOP("QJsonParseError", "unterminated object")

Definition at line 40 of file qjsonparser.cpp.

Referenced by QJsonParseError::errorString().

◆ JSONERR_UTERM_STR

#define JSONERR_UTERM_STR   QT_TRANSLATE_NOOP("QJsonParseError", "unterminated string")

Definition at line 49 of file qjsonparser.cpp.

Referenced by QJsonParseError::errorString().

◆ QT_PARSER_TRACING_BEGIN

#define QT_PARSER_TRACING_BEGIN   QT_NO_QDEBUG_MACRO()

Definition at line 25 of file qjsonparser.cpp.

◆ QT_PARSER_TRACING_DEBUG

#define QT_PARSER_TRACING_DEBUG   QT_NO_QDEBUG_MACRO()

Definition at line 29 of file qjsonparser.cpp.

Referenced by QJsonPrivate::Parser::parse(), and scanEscapeSequence().

◆ QT_PARSER_TRACING_END

#define QT_PARSER_TRACING_END
Value:
do { \
} while (0)

Definition at line 26 of file qjsonparser.cpp.

Referenced by QJsonPrivate::Parser::parse().

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
Space 
Tab 
LineFeed 
Return 
BeginArray 
BeginObject 
EndArray 
EndObject 
NameSeparator 
ValueSeparator 
Quote 

Definition at line 233 of file qjsonparser.cpp.

Function Documentation

◆ addHexDigit()

static bool addHexDigit ( char digit,
char32_t * result )
inlinestatic

Definition at line 784 of file qjsonparser.cpp.

References QtMiscUtils::fromHex().

Referenced by scanEscapeSequence(), and scanEscapeSequence().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ customAssigningUniqueLast()

template<typename Iterator , typename Compare , typename Assign >
static Iterator customAssigningUniqueLast ( Iterator first,
Iterator last,
Compare compare,
Assign assign )
static

Definition at line 357 of file qjsonparser.cpp.

References compare(), and Q_ASSERT.

Referenced by sortContainer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ scanEscapeSequence()

static bool scanEscapeSequence ( const char *& json,
const char * end,
char32_t * ch )
inlinestatic

Definition at line 796 of file qjsonparser.cpp.

References addHexDigit(), ch, i, and QT_PARSER_TRACING_DEBUG.

+ Here is the call graph for this function:

◆ scanUtf8Char()

static bool scanUtf8Char ( const char *& json,
const char * end,
char32_t * result )
inlinestatic

Definition at line 841 of file qjsonparser.cpp.

◆ sortContainer()

Variable Documentation

◆ nestingLimit

const int nestingLimit = 1024
static

Definition at line 32 of file qjsonparser.cpp.