QJson home page
QJson::Parser Class Reference

Main class used to convert JSON data to QVariant objects. More...

#include <parser.h>

Public Member Functions

QVariant parse (QIODevice *io, bool *ok=0)
 
QVariant parse (const QByteArray &jsonData, bool *ok=0)
 
QString errorString () const
 
int errorLine () const
 
void allowSpecialNumbers (bool allowSpecialNumbers)
 
bool specialNumbersAllowed () const
 

Detailed Description

Main class used to convert JSON data to QVariant objects.

Definition at line 41 of file parser.h.

Member Function Documentation

◆ allowSpecialNumbers()

void QJson::Parser::allowSpecialNumbers ( bool allowSpecialNumbers)

Sets whether special numbers (Infinity, -Infinity, NaN) are allowed as an extension to the standard

Parameters
allowSpecialNumbersnew value of whether special numbers are allowed
See also
specialNumbersAllowed

Definition at line 136 of file parser.cpp.

◆ errorLine()

int Parser::errorLine ( ) const

This method returns line number where the error occurred

Returns
the line number where the error occurred
See also
errorString

Definition at line 131 of file parser.cpp.

◆ errorString()

QString Parser::errorString ( ) const

This method returns the error message

Returns
a QString object containing the error message of the last parse operation
See also
errorLine

Definition at line 126 of file parser.cpp.

◆ parse() [1/2]

QVariant Parser::parse ( const QByteArray & jsonData,
bool * ok = 0 )

This is a method provided for convenience.

Parameters
jsonDatadata containing the JSON object representation
okif a conversion error occurs, *ok is set to false; otherwise *ok is set to true.
Returns
a QVariant object generated from the JSON string
See also
errorString
errorLine

Definition at line 118 of file parser.cpp.

References parse().

◆ parse() [2/2]

QVariant Parser::parse ( QIODevice * io,
bool * ok = 0 )

Read JSON string from the I/O Device and converts it to a QVariant object

Parameters
ioInput output device
okif a conversion error occurs, *ok is set to false; otherwise *ok is set to true.
Returns
a QVariant object generated from the JSON string

Definition at line 74 of file parser.cpp.

References yy::json_parser::parse().

Referenced by parse().

◆ specialNumbersAllowed()

bool Parser::specialNumbersAllowed ( ) const
Returns
whether special numbers (Infinity, -Infinity, NaN) are allowed
See also
allowSpecialNumbers

Definition at line 140 of file parser.cpp.


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

SourceForge Logo hosts this site. Send comments to:
QJson Developers