Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
Parser Class Reference

#include <elm/json/Parser.h>

Public Member Functions

 Parser (Maker &maker)
 
void parse (string s)
 
void parse (cstring s)
 
void parse (const char *s)
 
void parse (io::InStream &in)
 
void parse (sys::Path path)
 

Detailed Description

This class provide a simple way to read JSON structured format. It receive a Maker as parameter and the maker methods are called along the parsing of the JSOn text. This should allow top-level implementation of Maker to build back objects and arrays.

Notice that this parser supports a larger set of JSON text than the standard:

  • top-level simple values (integer, float, string) are accepted,
  • top-level array are accepted,
  • "//" and "/ *" ... "* /" are parsed and ignored (and doesn't cause error).
  • hexadecimal and binary integer prefixed by "0[xX]" or "0[bB]".

Constructor & Destructor Documentation

◆ Parser()

Parser ( Maker maker)

Build a new parser.

Parameters
makerMaker to use.

Member Function Documentation

◆ parse() [1/5]

void parse ( const char *  s)
inline

References Parser::parse().

Referenced by Parser::parse().

◆ parse() [2/5]

void parse ( cstring  s)
inline

References Parser::parse().

Referenced by Parser::parse().

◆ parse() [3/5]

void parse ( io::InStream in)

Parse from an input stream.

Parameters
inInput stream to use.

References MessageException::message().

◆ parse() [4/5]

void parse ( string  s)

Parser from a string.

Parameters
sString to parser.

Referenced by Parser::parse().

◆ parse() [5/5]

void parse ( sys::Path  path)

Parser from a file.

Parameters
pathFile path.

References SystemException::message(), Parser::parse(), and System::readFile().


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