Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
QtJson::Json Class Reference

A JSON data parser. More...

#include <json.h>

Static Public Member Functions

static QVariant parse (const QString &json)
static QVariant parse (const QString &json, bool &success)
static QByteArray serialize (const QVariant &data)
static QByteArray serialize (const QVariant &data, bool &success)

Static Private Member Functions

static QVariant parseValue (const QString &json, int &index, bool &success)
static QVariant parseObject (const QString &json, int &index, bool &success)
static QVariant parseArray (const QString &json, int &index, bool &success)
static QVariant parseString (const QString &json, int &index, bool &success)
static QVariant parseNumber (const QString &json, int &index)
static int lastIndexOfNumber (const QString &json, int index)
static void eatWhitespace (const QString &json, int &index)
static int lookAhead (const QString &json, int index)
static int nextToken (const QString &json, int &index)

Detailed Description

A JSON data parser.

Json parses a JSON data into a QVariant hierarchy.

Member Function Documentation

◆ eatWhitespace()

void QtJson::Json::eatWhitespace ( const QString & json,
int & index )
staticprivate

Skip unwanted whitespace symbols starting from index

Parameters
jsonThe JSON data
indexThe start index

eatWhitespace

Here is the caller graph for this function:

◆ lastIndexOfNumber()

int QtJson::Json::lastIndexOfNumber ( const QString & json,
int index )
staticprivate

Get the last index of a number starting from index

Parameters
jsonThe JSON data
indexThe starting index
Returns
The last index of the number

lastIndexOfNumber

Here is the caller graph for this function:

◆ lookAhead()

int QtJson::Json::lookAhead ( const QString & json,
int index )
staticprivate

Check what token lies ahead

Parameters
jsonThe JSON data
indexThe starting index
Returns
int The upcoming token

lookAhead

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

◆ nextToken()

int QtJson::Json::nextToken ( const QString & json,
int & index )
staticprivate

Get the next JSON token

Parameters
jsonThe JSON data
indexThe starting index
Returns
int The next JSON token

nextToken

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

◆ parse() [1/2]

QVariant QtJson::Json::parse ( const QString & json)
static

Parse a JSON string

Parameters
jsonThe JSON data

parse

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

◆ parse() [2/2]

QVariant QtJson::Json::parse ( const QString & json,
bool & success )
static

Parse a JSON string

Parameters
jsonThe JSON data
successThe success of the parsing

parse

Here is the call graph for this function:

◆ parseArray()

QVariant QtJson::Json::parseArray ( const QString & json,
int & index,
bool & success )
staticprivate

Parses an array starting from index

Parameters
jsonThe JSON data
indexThe starting index
successThe success of the array parse
Returns
QVariant The parsed variant array

parseArray

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

◆ parseNumber()

QVariant QtJson::Json::parseNumber ( const QString & json,
int & index )
staticprivate

Parses a number starting from index

Parameters
jsonThe JSON data
indexThe starting index
Returns
QVariant The parsed number

parseNumber

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

◆ parseObject()

QVariant QtJson::Json::parseObject ( const QString & json,
int & index,
bool & success )
staticprivate

Parses an object starting from index

Parameters
jsonThe JSON data
indexThe start index
successThe success of the object parse
Returns
QVariant The parsed object map

parseObject

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

◆ parseString()

QVariant QtJson::Json::parseString ( const QString & json,
int & index,
bool & success )
staticprivate

Parses a string starting from index

Parameters
jsonThe JSON data
indexThe starting index
successThe success of the string parse
Returns
QVariant The parsed string

parseString

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

◆ parseValue()

QVariant QtJson::Json::parseValue ( const QString & json,
int & index,
bool & success )
staticprivate

Parses a value starting from index

Parameters
jsonThe JSON data
indexThe start index
successThe success of the parse process
Returns
QVariant The parsed value

parseValue

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

◆ serialize() [1/2]

QByteArray QtJson::Json::serialize ( const QVariant & data)
static

This method generates a textual JSON representation

Parameters
dataThe JSON data generated by the parser.
successThe success of the serialization
Here is the call graph for this function:
Here is the caller graph for this function:

◆ serialize() [2/2]

QByteArray QtJson::Json::serialize ( const QVariant & data,
bool & success )
static

This method generates a textual JSON representation

Parameters
dataThe JSON data generated by the parser.
successThe success of the serialization
Returns
QByteArray Textual JSON representation
Here is the call graph for this function:

The documentation for this class was generated from the following files: