Open Lighting Architecture: ola::web::BaseValidator Class Reference

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ola::web::BaseValidator Class Reference
JSON

## Detailed Description

The base class for Json BaseValidators. All Visit methods return false.

Inheritance diagram for ola::web::BaseValidator:

## Public Member Functions
virtual bool | IsValid () const
| Check if the value was valid according to this validator.
virtual void | Visit (const JsonString &)
virtual void | Visit (const JsonBool &)
virtual void | Visit (const JsonNull &)
virtual void | Visit (const JsonRawValue &)
virtual void | Visit (const JsonObject &)
virtual void | Visit (const JsonArray &)
virtual void | Visit (const JsonUInt &)
virtual void | Visit (const JsonUInt64 &)
virtual void | Visit (const JsonInt &)
virtual void | Visit (const JsonInt64 &)
virtual void | Visit (const JsonDouble &)
virtual JsonObject * | GetSchema () const
| Returns the Schema as a JsonObject.
void | SetSchema (const std::string &schema)
| Set the schema.
void | SetId (const std::string &id)
| Set the id.
void | SetTitle (const std::string &title)
| Set the title.
void | SetDescription (const std::string &title)
| Set the description.
void | SetDefaultValue (const JsonValue *value)
| Set the default value for this validator.
const JsonValue * | GetDefaultValue () const
| Return the default value.
void | AddEnumValue (const JsonValue *value)
| Add a enum value to the list of allowed values.

## Protected Member Functions
| BaseValidator (JsonType type)
bool | CheckEnums (const JsonValue &value)
virtual void | ExtendSchema (JsonObject *schema) const

## Protected Attributes
bool | m_is_valid
JsonType | m_type
std::string | m_schema
std::string | m_id
std::string | m_title
std::string | m_description
std::auto_ptr< const JsonValue > | m_default_value
std::vector< const JsonValue * > | m_enums

## Additional Inherited Members
Public Types inherited from ola::web::ValidatorInterface
typedef std::vector< ValidatorInterface * > | ValidatorList
| a list of Validators.

## Member Function Documentation

## ◆ AddEnumValue()

void ola::web::BaseValidator::AddEnumValue | ( | const JsonValue * | value | ) |

Add a enum value to the list of allowed values.

Parameters

  value | the JsonValue to add, ownership is transferred.

## ◆ GetDefaultValue()

const JsonValue * ola::web::BaseValidator::GetDefaultValue | ( |  | ) | const
| virtual

Return the default value.

Returns
  The default value, or NULL if there isn't one.

Implements ola::web::ValidatorInterface.

## ◆ GetSchema()

JsonObject * ola::web::BaseValidator::GetSchema | ( |  | ) | const
| virtual

Returns the Schema as a JsonObject.

Returns
  A new JsonObject that represents the schema. Ownership of the JsonObject is transferred to the caller.

Implements ola::web::ValidatorInterface.

## ◆ IsValid()

virtual bool ola::web::BaseValidator::IsValid | ( |  | ) | const
| inlinevirtual

Check if the value was valid according to this validator.

Implements ola::web::ValidatorInterface.

Reimplemented in ola::web::WildcardValidator.

## ◆ SetDefaultValue()

void ola::web::BaseValidator::SetDefaultValue | ( | const JsonValue * | value | ) |
| virtual

Set the default value for this validator.

Parameters

  value | the default value, ownership is transferred.

Implements ola::web::ValidatorInterface.

## ◆ SetDescription()

void ola::web::BaseValidator::SetDescription | ( | const std::string & | title | ) |
| virtual

Set the description.

Implements ola::web::ValidatorInterface.

## ◆ SetId()

void ola::web::BaseValidator::SetId | ( | const std::string & | id | ) |
| virtual

Set the id.

Implements ola::web::ValidatorInterface.

## ◆ SetSchema()

void ola::web::BaseValidator::SetSchema | ( | const std::string & | schema | ) |
| virtual

Set the schema.

Implements ola::web::ValidatorInterface.

## ◆ SetTitle()

void ola::web::BaseValidator::SetTitle | ( | const std::string & | title | ) |
| virtual

Set the title.

Implements ola::web::ValidatorInterface.

## ◆ Visit() [1/11]

virtual void ola::web::BaseValidator::Visit | ( | const JsonArray & |  | ) |
| inlinevirtual

Implements ola::web::JsonValueConstVisitorInterface.

## ◆ Visit() [2/11]

virtual void ola::web::BaseValidator::Visit | ( | const JsonBool & |  | ) |
| inlinevirtual

Implements ola::web::JsonValueConstVisitorInterface.

## ◆ Visit() [3/11]

virtual void ola::web::BaseValidator::Visit | ( | const JsonDouble & |  | ) |
| inlinevirtual

Implements ola::web::JsonValueConstVisitorInterface.

## ◆ Visit() [4/11]

virtual void ola::web::BaseValidator::Visit | ( | const JsonInt & |  | ) |
| inlinevirtual

Implements ola::web::JsonValueConstVisitorInterface.

## ◆ Visit() [5/11]

virtual void ola::web::BaseValidator::Visit | ( | const JsonInt64 & |  | ) |
| inlinevirtual

Implements ola::web::JsonValueConstVisitorInterface.

## ◆ Visit() [6/11]

virtual void ola::web::BaseValidator::Visit | ( | const JsonNull & |  | ) |
| inlinevirtual

Implements ola::web::JsonValueConstVisitorInterface.

## ◆ Visit() [7/11]

virtual void ola::web::BaseValidator::Visit | ( | const JsonObject & |  | ) |
| inlinevirtual

Implements ola::web::JsonValueConstVisitorInterface.

## ◆ Visit() [8/11]

virtual void ola::web::BaseValidator::Visit | ( | const JsonRawValue & |  | ) |
| inlinevirtual

Implements ola::web::JsonValueConstVisitorInterface.

## ◆ Visit() [9/11]

virtual void ola::web::BaseValidator::Visit | ( | const JsonString & |  | ) |
| inlinevirtual

Implements ola::web::JsonValueConstVisitorInterface.

## ◆ Visit() [10/11]

virtual void ola::web::BaseValidator::Visit | ( | const JsonUInt & |  | ) |
| inlinevirtual

Implements ola::web::JsonValueConstVisitorInterface.

## ◆ Visit() [11/11]

virtual void ola::web::BaseValidator::Visit | ( | const JsonUInt64 & |  | ) |
| inlinevirtual

Implements ola::web::JsonValueConstVisitorInterface.

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

- include/ola/web/JsonSchema.h
- common/web/JsonSchema.cpp