Open Lighting Architecture
0.9.4
|
Build the tree of validators and a SchemaDefinitions object from a JSON Schema.
The SchemaParser is an implementation of JsonParserInterface. As the JsonLexer encounters each token, it calls the appropriate method on the SchemaParser. The SchemaParser maintains a stack of contexts, each of which corresponds to a different part of the JSON schema. As objects / arrays are opened / closed, new contexts are added / removed from the context stack.
Public Member Functions | |
SchemaParser () | |
Create a new SchemaParser. | |
~SchemaParser () | |
Clean up. | |
void | Begin () |
Called when parsing begins. | |
void | End () |
Called when parsing completes. | |
void | String (const std::string &value) |
Called when a string is encounted. | |
void | Number (uint32_t value) |
Called when a uint32_t is encounted. | |
void | Number (int32_t value) |
Called when a int32_t is encounted. | |
void | Number (uint64_t value) |
Called when a uint64_t is encounted. | |
void | Number (int64_t value) |
Called when a int64_t is encounted. | |
void | Number (const JsonDouble::DoubleRepresentation &rep) |
Called when a double value is encounted. | |
void | Number (double value) |
Called when a double value is encounted. | |
void | Bool (bool value) |
Called when a bool is encounted. | |
void | Null () |
Called when a null token is encounted. | |
void | OpenArray () |
Called when an array starts. | |
void | CloseArray () |
Called when an array completes. | |
void | OpenObject () |
Called when an object starts. | |
void | ObjectKey (const std::string &key) |
Called when a new key is encounted. | |
void | CloseObject () |
Called when an object completes. | |
void | SetError (const std::string &error) |
Can be called at any time to indicate an error with the input data. | |
bool | IsValidSchema () |
Check if the schema was valid. | |
std::string | Error () const |
Get the error message. | |
ValidatorInterface * | ClaimRootValidator () |
Claim the RootValidator that was created by parsing the schema. | |
SchemaDefinitions * | ClaimSchemaDefs () |
Claim the SchemaDefinitions that were created by parsing the schema. |
ValidatorInterface * ola::web::SchemaParser::ClaimRootValidator | ( | ) |
Claim the RootValidator that was created by parsing the schema.
SchemaDefinitions * ola::web::SchemaParser::ClaimSchemaDefs | ( | ) |
Claim the SchemaDefinitions that were created by parsing the schema.
bool ola::web::SchemaParser::IsValidSchema | ( | ) |
Check if the schema was valid.
|
virtual |
Called when a double value is encounted.
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.
Implements ola::web::JsonParserInterface.
|
virtual |
Called when a new key is encounted.
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.
Implements ola::web::JsonParserInterface.
|
virtual |
Called when a string is encounted.
This is not called for object keys, see ObjectKey() below.
Implements ola::web::JsonParserInterface.