Open Lighting Architecture  Latest Git
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | List of all members
ola::web::JsonParserInterface Class Referenceabstract

Detailed Description

The interface used to handle tokens during JSON parsing.

As the JsonLexer traverses the input string, it calls the methods below.

Inheritance diagram for ola::web::JsonParserInterface:
Inheritance graph
[legend]

Public Member Functions

virtual void Begin ()=0
 Called when parsing begins.
 
virtual void End ()=0
 Called when parsing completes.
 
virtual void String (const std::string &value)=0
 Called when a string is encountered. More...
 
virtual void Number (uint32_t value)=0
 Called when a uint32_t is encountered.
 
virtual void Number (int32_t value)=0
 Called when a int32_t is encountered.
 
virtual void Number (uint64_t value)=0
 Called when a uint64_t is encountered.
 
virtual void Number (int64_t value)=0
 Called when a int64_t is encountered.
 
virtual void Number (const JsonDouble::DoubleRepresentation &rep)=0
 Called when a double value is encountered. More...
 
virtual void Number (double d)=0
 Called when a double value is encountered.
 
virtual void Bool (bool value)=0
 Called when a bool is encountered.
 
virtual void Null ()=0
 Called when a null token is encountered.
 
virtual void OpenArray ()=0
 Called when an array starts.
 
virtual void CloseArray ()=0
 Called when an array completes.
 
virtual void OpenObject ()=0
 Called when an object starts.
 
virtual void ObjectKey (const std::string &key)=0
 Called when a new key is encountered. More...
 
virtual void CloseObject ()=0
 Called when an object completes.
 
virtual void SetError (const std::string &error)=0
 Can be called at any time to indicate an error with the input data.
 

Member Function Documentation

virtual void ola::web::JsonParserInterface::Number ( const JsonDouble::DoubleRepresentation rep)
pure virtual

Called when a double value is encountered.

MinGW struggles with long doubles http://mingw.5.n7.nabble.com/Strange-behaviour-of-gcc-4-8-1-with-long-double-td32949.html To avoid this, and to keep as many significant bits as possible we keep the components of a double separate. See JsonDouble for details.

Implemented in ola::web::SchemaParser, ola::web::JsonParser, and ola::web::JsonPatchParser.

virtual void ola::web::JsonParserInterface::ObjectKey ( const std::string &  key)
pure virtual

Called when a new key is encountered.

This may be called multiple times for the same object. The standard doesn't specify how to handle duplicate keys, so I generally use the last one.

Implemented in ola::web::SchemaParser, ola::web::JsonParser, and ola::web::JsonPatchParser.

virtual void ola::web::JsonParserInterface::String ( const std::string &  value)
pure virtual

Called when a string is encountered.

This is not called for object keys, see ObjectKey() below.

Implemented in ola::web::SchemaParser, ola::web::JsonParser, and ola::web::JsonPatchParser.


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