MQTTSuite
Loading...
Searching...
No Matches
anonymous_namespace{json-validator.cpp}::boolean Class Reference
Inheritance diagram for anonymous_namespace{json-validator.cpp}::boolean:
Collaboration diagram for anonymous_namespace{json-validator.cpp}::boolean:

Public Member Functions

 boolean (json &sch, root_schema *root)
 boolean (json &sch, root_schema *root)
Public Member Functions inherited from anonymous_namespace{json-validator.cpp}::schema
virtual ~schema ()=default
 schema (root_schema *root)
virtual const jsondefault_value (const json::json_pointer &, const json &, error_handler &) const
void set_default_value (const json &v)
virtual ~schema ()=default
 schema (root_schema *root)
virtual const jsondefault_value (const json::json_pointer &, const json &, error_handler &) const
void set_default_value (const json &v)

Private Member Functions

void validate (const json::json_pointer &ptr, const json &instance, json_patch &, error_handler &e) const override
void validate (const json::json_pointer &ptr, const json &instance, json_patch &, error_handler &e) const override

Private Attributes

bool true_

Additional Inherited Members

Static Public Member Functions inherited from anonymous_namespace{json-validator.cpp}::schema
static std::shared_ptr< schemamake (json &schema, root_schema *root, const std::vector< std::string > &key, std::vector< nlohmann::json_uri > uris)
static std::shared_ptr< schemamake (json &schema, root_schema *root, const std::vector< std::string > &key, std::vector< nlohmann::json_uri > uris)
Protected Member Functions inherited from anonymous_namespace{json-validator.cpp}::schema
virtual std::shared_ptr< schemamake_for_default_ (std::shared_ptr<::schema > &, root_schema *, std::vector< nlohmann::json_uri > &, nlohmann::json &) const
virtual std::shared_ptr< schemamake_for_default_ (std::shared_ptr<::schema > &, root_schema *, std::vector< nlohmann::json_uri > &, nlohmann::json &) const
Protected Attributes inherited from anonymous_namespace{json-validator.cpp}::schema
root_schemaroot_
json default_value_ = nullptr

Detailed Description

Definition at line 1000 of file json-validator.cpp.

Constructor & Destructor Documentation

◆ boolean() [1/2]

anonymous_namespace{json-validator.cpp}::boolean::boolean ( json & sch,
root_schema * root )
inline

Definition at line 1019 of file json-validator.cpp.

References anonymous_namespace{json-validator.cpp}::schema::schema(), and true_.

Here is the call graph for this function:

◆ boolean() [2/2]

anonymous_namespace{json-validator.cpp}::boolean::boolean ( json & sch,
root_schema * root )
inline

Definition at line 1019 of file json-validator.cpp.

1020 : schema(root), true_(sch) {}

Member Function Documentation

◆ validate() [1/2]

void anonymous_namespace{json-validator.cpp}::boolean::validate ( const json::json_pointer & ptr,
const json & instance,
json_patch & ,
error_handler & e ) const
inlineoverrideprivatevirtual

Implements anonymous_namespace{json-validator.cpp}::schema.

Definition at line 1003 of file json-validator.cpp.

1004 {
1005 if (!true_) { // false schema
1006 // empty array
1007 // switch (instance.type()) {
1008 // case json::value_t::array:
1009 // if (instance.size() != 0) // valid false-schema
1010 // e.error(ptr, instance, "false-schema required empty array");
1011 // return;
1012 //}
1013
1014 e.error(ptr, instance, "instance invalid as per false-schema");
1015 }
1016 }
virtual void error(const json::json_pointer &, const json &, const std::string &)=0
static const auto instance
Definition issue-93.cpp:14

References nlohmann::json_schema::error_handler::error(), and true_.

Here is the call graph for this function:

◆ validate() [2/2]

void anonymous_namespace{json-validator.cpp}::boolean::validate ( const json::json_pointer & ptr,
const json & instance,
json_patch & ,
error_handler & e ) const
inlineoverrideprivatevirtual

Implements anonymous_namespace{json-validator.cpp}::schema.

Definition at line 1003 of file json-validator.cpp.

1004 {
1005 if (!true_) { // false schema
1006 // empty array
1007 // switch (instance.type()) {
1008 // case json::value_t::array:
1009 // if (instance.size() != 0) // valid false-schema
1010 // e.error(ptr, instance, "false-schema required empty array");
1011 // return;
1012 //}
1013
1014 e.error(ptr, instance, "instance invalid as per false-schema");
1015 }
1016 }

Member Data Documentation

◆ true_

bool anonymous_namespace{json-validator.cpp}::boolean::true_
private

Definition at line 1002 of file json-validator.cpp.

Referenced by boolean(), and validate().


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