EvolvingObjects
eoserial::Parser Class Reference

Parser from a JSON source. More...

#include <Parser.h>

List of all members.

Static Public Member Functions

static eoserial::Objectparse (const std::string &str)
 Parses the given string and returns the JSON object read.

Static Protected Member Functions

static eoserial::EntityparseRight (const std::string &str, size_t &pos)
 Parses the right part of a JSON object as a string.
static void parseLeft (const std::string &str, size_t &pos, eoserial::Object *json)
 Parses the left value of a key-value pair, which is the key.
static eoserial::StringparseJsonString (const std::string &str, size_t &pos)
 Retrieves a string in a JSON content.

Detailed Description

Parser from a JSON source.

This parser does just retrieve values and does NOT check the structure of the input. This implies that if the input is not correct, the result is undefined and can result to a failure on execution.

Definition at line 55 of file Parser.h.


Member Function Documentation

Entity * eoserial::Parser::parseRight ( const std::string &  str,
size_t &  pos 
) [static, protected]

Parses the right part of a JSON object as a string.

The right part of an object can be a string (for instance : "key":"value"), a JSON array (for instance: "key":["1"]) or another JSON object (for instance: "key":{"another_key":"value"}).

The right parts are found after keys (which are parsed by parseLeft) and in arrays.

Parameters:
strThe string we're parsing.
posThe index of the current position in the string.
Returns:
The JSON object matching the right part.

Definition at line 117 of file Parser.cpp.

References eoserial::Array::push_back().

void eoserial::Parser::parseLeft ( const std::string &  str,
size_t &  pos,
eoserial::Object json 
) [static, protected]

Parses the left value of a key-value pair, which is the key.

Parameters:
strThe string we're parsing.
posThe index of the current position in the string.
jsonThe current JSON object for which we're adding a key-value pair.

Definition at line 162 of file Parser.cpp.

String * eoserial::Parser::parseJsonString ( const std::string &  str,
size_t &  pos 
) [static, protected]

Retrieves a string in a JSON content.

Parameters:
strThe string we're parsing.
posThe index of the current position of parsing, which will be updated.

Definition at line 106 of file Parser.cpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Friends