JAULA::Parser Class Reference
JAULA: JSON data parser

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_Complex * | parseStream (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 moron.nosp@m.go66.nosp@m.6@gma.nosp@m.il.c.nosp@m.om

## Constructor & Destructor Documentation

## Parser()

JAULA::Parser::Parser | ( | void |  | ) |

Constructor.

## ~Parser()

JAULA::Parser::~Parser | ( | void |  | ) |

Destructor.

## Member Function Documentation

## parseStream()

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(), JAULA::Parser::Value_Parser::parseValue(), and JAULA::Lexan::yylex().

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

- jaula_parse.h
- jaula_parse.cc

Back to JAULA Project Documentation Page.

Go to JAULA Project Home Page.

Copyright (c) 2007, 2008, 2009 Kombo Morongo.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".

SourceForge.net