Open Lighting Architecture  0.9.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Enumerations | Functions
ola::web Namespace Reference

Detailed Description

Classes to deal with web services.

Classes

class  OptionalItem
class  PointerTracker
 Maintains a Json Pointer (RFC 6901) given a set of Json parse events. More...
class  SchemaErrorLogger
 The SchemaErrorLogger captures errors while parsing the schema. More...
class  SchemaParseContextInterface
 The interface all SchemaParseContext classes inherit from. More...
class  ObjectParseContext
 A SchemaParseContext that keeps track of the last keyword / property seen. More...
class  StrictTypedParseContext
 A SchemaParseContext that reports errors for all types. More...
class  DefinitionsParseContext
 The context for schema definitions. More...
class  SchemaParseContext
class  PropertiesParseContext
class  ArrayOfSchemaContext
 Parse the array of objects in an 'items' property. More...
class  ArrayOfStringsContext
 The context for an array of strings. More...
class  JsonValueContext
 The context for a default value. More...
class  ArrayOfJsonValuesContext
 The context for an array of JsonValues. More...
class  DependencyParseContext
 The context for a dependency object. More...
class  SchemaParser
 Build the tree of validators and a SchemaDefinitions object from a JSON Schema. More...
class  JsonValueVisitorInterface
 The interface for the JsonValueVisitor class. More...
class  JsonValueConstVisitorInterface
 The const interface for the JsonValueVisitor class. More...
class  JsonValue
 The base class for JSON values. More...
class  JsonLeafValue
 A base class used to describe values which are leafs of a JSON tree. More...
class  JsonString
 A string value. More...
class  JsonNumber
 JsonNumber is the base class for various integer / number classes. More...
class  JsonUInt
 An unsigned 32bit int value. More...
class  JsonInt
 A signed 32bit int value. More...
class  JsonUInt64
 An unsigned 64bit int value. More...
class  JsonInt64
 A signed 64bit int value. More...
class  JsonDouble
 A double value. More...
class  JsonBool
 A Bool value. More...
class  JsonNull
 The null value. More...
class  JsonRawValue
 A raw value, useful if you want to cheat. More...
class  JsonObject
 A JSON object. JSON Objects are key : value mappings, similar to dictionaries in Python. More...
class  JsonArray
 An array of JSON values. Arrays in JSON can contain values of different types. More...
class  JsonObjectPropertyVisitor
 A class used to visit Json values within a JsonObject. More...
class  JsonData
 Represents a JSON text as defined in section 2 of RFC7158. More...
class  JsonLexer
 Parse a string containing Json data. More...
class  JsonParserInterface
 The interface used to handle tokens during JSON parsing. More...
class  JsonParser
 A JsonParserInterface implementation that builds a tree of JsonValues. More...
class  JsonPatchOp
 A class to serialize a JSONValue to text. More...
class  JsonPatchAddOp
 Add a JsonValue. More...
class  JsonPatchRemoveOp
 Remove the value at the specifed path. More...
class  JsonPatchReplaceOp
 Replace the value at the specifed path. More...
class  JsonPatchMoveOp
 Move a value from one location to another. More...
class  JsonPatchCopyOp
 Copy a value from one location to another. More...
class  JsonPatchTestOp
 Test a path matches the specified value. More...
class  JsonPatchSet
 An ordered collection of JsonPatchOps. More...
class  JsonPatchParser
 Parse a JSON Patch document (RFC 6902). More...
class  JsonPointer
 A JSON pointer (RFC 6901) refers to a possible element in a JSON data structure. More...
class  ValidatorInterface
 The interface Json Schema Validators. More...
class  BaseValidator
 The base class for Json BaseValidators. All Visit methods return false. More...
class  WildcardValidator
 The wildcard validator matches everything. This corresponds to the empty schema, i.e. {}. More...
class  ReferenceValidator
 A reference validator holds a pointer to another schema. More...
class  StringValidator
 The validator for JsonString. More...
class  BoolValidator
 The validator for JsonBool. More...
class  NullValidator
 The validator for JsonNull. More...
class  NumberConstraint
 The base class for constraints that can be applies to the Json number type. More...
class  MultipleOfConstraint
 Confirms the valid is a multiple of the specified value. More...
class  MaximumConstraint
 Enforces a maximum. More...
class  MinimumConstraint
 Enforces a minimum. More...
class  IntegerValidator
 The validator for Json integers. More...
class  NumberValidator
 The validator for Json numbers. More...
class  ObjectValidator
 The validator for JsonObject. More...
class  ArrayValidator
 The validator for JsonArray. More...
class  ConjunctionValidator
 The base class for validators that operate with a list of child validators (allOf, anyOf, oneOf). More...
class  AllOfValidator
 A validator which ensures all child validators pass (allOf). More...
class  AnyOfValidator
 A validator which ensures at least one of the child validators pass (anyOf). More...
class  OneOfValidator
 A validator which ensures at only one of the child validators pass (oneOf). More...
class  NotValidator
 A validator that inverts the result of the child (not). More...
class  SchemaDefinitions
class  JsonSchema
 A JsonHandlerInterface implementation that builds a parse tree. More...
class  GenericItem
class  StringItem
class  UIntItem
class  BoolItem
class  HiddenItem
class  SelectItem
class  JsonSection
class  JsonWriter
 A class to serialize a JSONValue to text. More...

Enumerations

enum  SchemaKeyword {
  SCHEMA_UNKNOWN, SCHEMA_ID, SCHEMA_SCHEMA, SCHEMA_REF,
  SCHEMA_TITLE, SCHEMA_DESCRIPTION, SCHEMA_DEFAULT, SCHEMA_FORMAT,
  SCHEMA_MULTIPLEOF, SCHEMA_MAXIMUM, SCHEMA_EXCLUSIVE_MAXIMUM, SCHEMA_MINIMUM,
  SCHEMA_EXCLUSIVE_MINIMUM, SCHEMA_MAX_LENGTH, SCHEMA_MIN_LENGTH, SCHEMA_PATTERN,
  SCHEMA_ADDITIONAL_ITEMS, SCHEMA_ITEMS, SCHEMA_MAX_ITEMS, SCHEMA_MIN_ITEMS,
  SCHEMA_UNIQUE_ITEMS, SCHEMA_MAX_PROPERTIES, SCHEMA_MIN_PROPERTIES, SCHEMA_REQUIRED,
  SCHEMA_ADDITIONAL_PROPERTIES, SCHEMA_DEFINITIONS, SCHEMA_PROPERTIES, SCHEMA_PATTERN_PROPERTIES,
  SCHEMA_DEPENDENCIES, SCHEMA_ENUM, SCHEMA_TYPE, SCHEMA_ALL_OF,
  SCHEMA_ANY_OF, SCHEMA_ONE_OF, SCHEMA_NOT
}
 The list of valid JSon Schema keywords. More...
enum  JsonType {
  JSON_ARRAY, JSON_BOOLEAN, JSON_INTEGER, JSON_NULL,
  JSON_NUMBER, JSON_OBJECT, JSON_STRING, JSON_UNDEFINED
}
 The type of JSON data element. More...

Functions

JsonObjectObjectCast (JsonValue *value)
 Downcast a JsonValue to a JsonObject.
JsonArrayArrayCast (JsonValue *value)
 Downcast a JsonValue to a JsonArray.
std::ostream & operator<< (std::ostream &os, const JsonString &value)
std::ostream & operator<< (std::ostream &os, const JsonUInt &value)
std::ostream & operator<< (std::ostream &os, const JsonInt &value)
std::ostream & operator<< (std::ostream &os, const JsonUInt64 &value)
std::ostream & operator<< (std::ostream &os, const JsonInt64 &value)
std::ostream & operator<< (std::ostream &os, const JsonDouble &value)
std::ostream & operator<< (std::ostream &os, const JsonBool &value)
std::ostream & operator<< (std::ostream &os, const JsonNull &)
std::ostream & operator<< (std::ostream &os, const JsonRawValue &value)
static bool ParseTrimmedInput (const char **input, JsonParserInterface *parser)
static bool TrimWhitespace (const char **input)
 Trim leading whitespace from a string.
static bool ParseString (const char **input, string *str, JsonParserInterface *parser)
 Extract a string token from the input.
bool ExtractDigits (const char **input, uint64_t *i, unsigned int *leading_zeros=NULL)
static bool ParseNumber (const char **input, JsonParserInterface *parser)
static bool ParseArray (const char **input, JsonParserInterface *parser)
static bool ParseObject (const char **input, JsonParserInterface *parser)
bool ParseRaw (const char *input, JsonParserInterface *parser)
std::string JsonTypeToString (JsonType type)
 Get the string corresponding to a JsonType.
JsonType StringToJsonType (const string &type)
string KeywordToString (SchemaKeyword keyword)
SchemaKeyword LookupKeyword (const string &keyword)
SchemaKeyword LookupKeyword (const std::string &keyword)
 Map a string to a SchemaKeyword.
template<>
JsonNumberJsonValue::NewNumberValue< JsonDouble::DoubleRepresentation > (const JsonDouble::DoubleRepresentation &value)
template<>
JsonValueJsonValue::NewValue< std::string > (const std::string &value)
template<>
JsonValueJsonValue::NewValue< JsonDouble::DoubleRepresentation > (const JsonDouble::DoubleRepresentation &value)
JsonType StringToJsonType (const std::string &type)
 Convert a string to a JsonType.
template<typename T >
JsonType TypeFromValue (const T &)
 Given a value, return the JsonType this value corresponds to.
template<typename T >
std::string GetTypename (const T &t)
 Given a value, return the string name this value corresponds to.
template<>
JsonType TypeFromValue< std::string > (const std::string &)
template<>
JsonType TypeFromValue< bool > (const bool &)
template<>
JsonType TypeFromValue< uint32_t > (const uint32_t &)
template<>
JsonType TypeFromValue< int32_t > (const int32_t &)
template<>
JsonType TypeFromValue< uint64_t > (const uint64_t &)
template<>
JsonType TypeFromValue< int64_t > (const int64_t &)
template<>
JsonType TypeFromValue< double > (const double &)

Enumeration Type Documentation

The type of JSON data element.

This comes from section 3.5 of the JSON Schema core document.

Enumerator:
JSON_ARRAY 

An Array

JSON_BOOLEAN 

A boolean

JSON_INTEGER 

An integer

JSON_NULL 

A null value

JSON_NUMBER 

A number

JSON_OBJECT 

An object

JSON_STRING 

A string

JSON_UNDEFINED 

A unknown type

The list of valid JSon Schema keywords.

Enumerator:
SCHEMA_UNKNOWN 

Keywords we don't understand

Function Documentation

std::string ola::web::JsonTypeToString ( JsonType  type)

Get the string corresponding to a JsonType.

e.g. TypeToString(JSON_STRING) returns "string".

std::string ola::web::KeywordToString ( SchemaKeyword  keyword)

Return the string used by the SchemaKeyword.

SchemaKeyword ola::web::LookupKeyword ( const std::string &  keyword)

Map a string to a SchemaKeyword.

Returns
the SchemaKeyword corresponding to the string, or SCHEMA_UNDEFINED.
static bool ola::web::ParseArray ( const char **  input,
JsonParserInterface *  parser 
)
static

Starts from the first character after the '['.

static bool ola::web::ParseNumber ( const char **  input,
JsonParserInterface *  parser 
)
static

Parse a JsonNumber

static bool ola::web::ParseObject ( const char **  input,
JsonParserInterface *  parser 
)
static

Starts from the first character after the '{'.

static bool ola::web::ParseString ( const char **  input,
string *  str,
JsonParserInterface *  parser 
)
static

Extract a string token from the input.

Parameters
inputA pointer to a pointer with the data. This should point to the first character after the quote (") character.
strA string object to store the extracted string.
parserthe JsonParserInterface to pass tokens to.
Returns
true if the string was extracted correctly, false otherwise.
JsonType ola::web::StringToJsonType ( const std::string &  type)

Convert a string to a JsonType.

Returns
The JsonType, or JSON_UNDEFINED if the string isn't a valid type.

e.g. StringToType("string") returns JSON_STRING.

static bool ola::web::TrimWhitespace ( const char **  input)
static

Trim leading whitespace from a string.

Parameters
inputA pointer to a pointer with the data. This is updated to point to the first non-whitespace character.
Returns
true if more data remains, false if the string is now empty.
Note
This is static within JsonLexer.cpp because we should be using strings rather than char[]s. The only reason this doesn't use a string is because I think we'll need a wchar on Windows.