|
Parsnip
parsing library
|
Schema component requiring data be a string of characters (no control characters). More...
#include <parsnip_schema.h>
Public Types | |
| using | size_type = StringType::size_type |
Public Member Functions | |
| StringSchema (size_type min=0, size_type max=std::numeric_limits< size_type >::max()) | |
| Validate a type schema: ensure the datatype is as expected. | |
| StringSchema (const StringSchema &)=default | |
| StringSchema (StringSchema &&)=default | |
| StringSchema & | operator= (const StringSchema &)=default |
| StringSchema & | operator= (StringSchema &&)=default |
| StringSchema (const Parsnip::Data &schema_spec) | |
| Construct a string validator from a schema specification. | |
| virtual StringSchema * | createCopy () const override |
| Create an identical, deep copy of the schema. | |
| virtual void | validate (const Parsnip::Data &entry) const override |
| Verify that Data matches the schema. | |
| virtual bool | operator== (const SchemaBase &other) const override |
| Check if two schemas perform the same validation. | |
| 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 |
| virtual void | mergeSchemas (const SchemaBase &from) |
| Merge elements into the current schema. | |
Protected Attributes | |
| size_type | min_length |
| size_type | max_length |
Protected Attributes inherited from Parsnip::SchemaBase | |
| bool | nullable = false |
If true, element may be null. | |
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. | |
Schema component requiring data be a string of characters (no control characters).
If no character checking is desired, use a TypeSchema instead.
| Parsnip::StringSchema::StringSchema | ( | size_type | min = 0, |
| size_type | max = std::numeric_limits<size_type>::max() |
||
| ) |
Validate a type schema: ensure the datatype is as expected.
Construct a string schema.
| min | Minimum length of valid strings. |
| max | Maximum length of valid strings. |
|
overridevirtual |
Create an identical, deep copy of the schema.
Caller is responsible for deleting it.
Implements Parsnip::SchemaBase.
Reimplemented in Parsnip::RegExSchema.
|
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.
Reimplemented in Parsnip::RegExSchema.
|
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.
Reimplemented in Parsnip::RegExSchema.
|
overridevirtual |
Verify that Data matches the schema.
| entry | The data to validate. |
| Various | exceptions. |
Implements Parsnip::SchemaBase.
Reimplemented in Parsnip::RegExSchema.