JSON Data Parser.
More...
#include <jaula_parse.h>
|
static Value_Complex * | parseStream (std::istream &inpStream, bool comments_allowed=false, bool full_read=true) throw (Exception) |
| Parses JSON data from a stream. More...
|
|
JSON Data Parser.
- This class implements the JSON parser itself as specified by RFC 4627.
- Author
- Kombo Morongo moron.nosp@m.go66.nosp@m.6@gma.nosp@m.il.c.nosp@m.om
JAULA::Parser::Parser |
( |
void |
| ) |
|
JAULA::Parser::~Parser |
( |
void |
| ) |
|
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
-
inpStream | stream from where to read the data to parse. |
comments_allowed | flag 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_read | flag 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
-
Exception | An 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: