jaula API Reference version 1.4.0
JAULA::Parser Class Reference

JSON Data Parser. More...

#include <jaula_parse.h>

Data Structures

class  Value_Parser
 JSON Value Parser. More...

Public Member Functions

 Parser (void)
 Constructor.
 ~Parser (void)
 Destructor.

Static Public Member Functions

static Value_ComplexparseStream (std::istream &inpStream, bool comments_allowed=false, bool full_read=true) throw (Exception)
 Parses JSON data from a stream.

Detailed Description

JSON Data Parser.

This class implements the JSON parser itself as specified by RFC 4627.
Author:
Kombo Morongo <morongo666@gmail.com>

Constructor & Destructor Documentation

JAULA::Parser::Parser ( void  )

Constructor.

JAULA::Parser::~Parser ( void  )

Destructor.


Member Function Documentation

Value_Complex * JAULA::Parser::parseStream ( std::istream &  inpStream,
bool  comments_allowed = false,
bool  full_read = true 
) throw (Exception) [static]

Parses JSON data from a stream.

Parameters:
inpStreamstream from where to read the data to parse.
comments_allowedflag that if it is true means that the input can contain comments that begin with the hash '#' symbol and ends with eoln (as in bash). If it is false, it means that no comments are allowed in the input and if present will be considered as a syntax error.
full_readflag that if it is true means that the parser must analyze the input stream until the end of file is although it already had got a full array or object from it. In this situation, as JSON specification expects just only one array or object per input, any further data that is not a space for the syntax (or a comment if comments are allowed) will launch a syntax error exception.
If this flag is false, the parser will stop once a full array or object is taken from the input and, on exit, the stream will point to the start of the remaining data.
Returns:
a pointer to memory taken from the heap containing a complex value (array or object) with all the data from the stream parsed on individual / nested items.
Exceptions:
ExceptionAn exception will be thrown as soon as a lexical or syntax error is found analyzing the stream. The result of printing the exception through a stream is a human readable text explaining the error found and an approximation of the error line where occurred.
Description
This method is the entry point for the JSON parser.
Warning:
As this method returns a pointer to memory from the heap, it is up to the user to free it when it is no longer needed in order to avoid leaks.

References JAULA::Exception::addOrigin(), and JAULA::Lexan::yylex().


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