|
Parsnip
parsing library
|
Schema component accepting strings with certain values. More...
#include <parsnip_schema.h>
Public Member Functions | |
| KeywordSchema (const KeywordSchema &)=default | |
| KeywordSchema (KeywordSchema &&)=default | |
| KeywordSchema & | operator= (const KeywordSchema &)=default |
| KeywordSchema & | operator= (KeywordSchema &&)=default |
| KeywordSchema (const std::string &word) | |
| Construct a keyword schema, starting with one initial keyword. | |
| KeywordSchema (const Parsnip::Data &schema_spec) | |
| Construct a keyword (string enumeration) schema from a specification. | |
| virtual KeywordSchema * | createCopy () const override |
| Create an identical, deep copy of the schema. | |
| void | addKeyword (const std::string &word) |
| Add an additional keyword that the schema will allow. | |
| virtual void | validate (const Parsnip::Data &entry) const override |
| Validate a Keyword: ensure the datatype is a string, and that it matches one of the allowed values. | |
| virtual bool | operator== (const SchemaBase &other) const override |
| Check if two schemas perform the same validation. | |
| virtual void | mergeSchemas (const SchemaBase &from) override |
| Merge elements into the current schema. | |
| virtual std::ostream & | dump (std::ostream &target, int indent, bool suppress_ident=false) const override |
| Render the schema in human-friendly text. | |
Public Member Functions inherited from Parsnip::SchemaBase | |
| bool | operator!= (const SchemaBase &other) const |
Additional Inherited Members | |
Protected Types inherited from Parsnip::SchemaBase | |
| using | StringType = Data::StringType |
| using | SchemaRegex = std::basic_regex< StringType::value_type > |
Protected Member Functions inherited from Parsnip::SchemaBase | |
| SchemaBase (const SchemaBase &)=default | |
| SchemaBase (SchemaBase &&)=default | |
| SchemaBase & | operator= (const SchemaBase &)=default |
| SchemaBase & | operator= (SchemaBase &&)=default |
| SchemaBase (const Parsnip::Data &schema_spec) | |
| Construct a schema from a JSON specification. | |
| void | checkType (Data::Type expected, const Parsnip::Data &entry) const |
| Check that Data item is an allowed type. | |
| bool | isValidlyNull (const Parsnip::Data &entry) const |
| Determine if the data is Null and if that is allowed. | |
| bool | isType (Data::Type expected, const Parsnip::Data &entry) const |
| Check if a data object is a particular type. | |
Protected Attributes inherited from Parsnip::SchemaBase | |
| bool | nullable = false |
If true, element may be null. | |
Schema component accepting strings with certain values.
| void Parsnip::KeywordSchema::addKeyword | ( | const std::string & | word | ) |
Add an additional keyword that the schema will allow.
| word | The keyword to allow. |
|
overridevirtual |
Create an identical, deep copy of the schema.
Caller is responsible for deleting it.
Implements Parsnip::SchemaBase.
|
overridevirtual |
Render the schema in human-friendly text.
| target | Where to write the schema. |
| indent | Amount of indent to use. |
| suppress_indent | Flag indicating indent was already performed. |
Implements Parsnip::SchemaBase.
|
overridevirtual |
Merge elements into the current schema.
Merge elements managed by this class.
| from | A schema for a valid command command line. |
| Various | exceptions. |
Reimplemented from Parsnip::SchemaBase.
|
overridevirtual |
Check if two schemas perform the same validation.
Compare two schemas to see if they determine validity in the same manner.
| other | The schema to compare to. |
Reimplemented from Parsnip::SchemaBase.
|
overridevirtual |
Validate a Keyword: ensure the datatype is a string, and that it matches one of the allowed values.
Implements Parsnip::SchemaBase.