Schema component for validating dictionaries.
More...
#include <parsnip_schema.h>
Schema component for validating dictionaries.
◆ Dependencies
◆ size_type
◆ AdditionalMemberNames
| Enumerator |
|---|
| NONE | |
| ANY | |
| PATTERN | |
◆ DictionarySchema() [1/4]
| Parsnip::DictionarySchema::DictionarySchema |
( |
| ) |
|
|
default |
◆ DictionarySchema() [2/4]
◆ DictionarySchema() [3/4]
◆ DictionarySchema() [4/4]
| Parsnip::DictionarySchema::DictionarySchema |
( |
const Parsnip::Data & |
schema_spec | ) |
|
Construct a dictionary (object) schema from a schema specificiation.
- Parameters
-
| schema_spec | The specification. |
◆ addMember()
Add a member to a dictionary schema.
- Parameters
-
| name | The name of the member to add. |
| schema | The schema for the new member. |
| mandatory | If true, the member must be present for the dictionary to be valid. |
| dependencies | Any members that must be present when the new member is present. |
◆ createCopy()
Create an identical, deep copy of the schema.
Caller is responsible for deleting it.
Implements Parsnip::SchemaBase.
◆ dump()
| std::ostream & Parsnip::DictionarySchema::dump |
( |
std::ostream & |
target, |
|
|
int |
indent, |
|
|
bool |
suppress_indent = false |
|
) |
| const |
|
overridevirtual |
Render the schema in human-friendly text.
- Parameters
-
| target | Where to write the schema. |
| indent | Amount of indent to use. |
| suppress_indent | Flag indicating indent was already performed. |
Implements Parsnip::SchemaBase.
◆ mergeSchemas()
| void Parsnip::DictionarySchema::mergeSchemas |
( |
const SchemaBase & |
from | ) |
|
|
overridevirtual |
Merge elements into the current schema.
Merge elements managed by this class.
- Elements seen every time are mandatory.
- Elements seen only sometime are optional.
- Elements always seen together are codependent.
- Elements must always expect similar types, except they may vary as element and list-of-same-element.
- Parameters
-
| from | A schema for a valid command command line. |
- Exceptions
-
Reimplemented from Parsnip::SchemaBase.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ operator==()
| bool Parsnip::DictionarySchema::operator== |
( |
const SchemaBase & |
other | ) |
const |
|
overridevirtual |
Check if two schemas perform the same validation.
Compare two schemas to see if they determine validity in the same manner.
- Parameters
-
| other | The schema to compare to. |
- Returns
- True if the schemas match, false otherwise.
Reimplemented from Parsnip::SchemaBase.
◆ removeMember()
| void Parsnip::DictionarySchema::removeMember |
( |
const char * |
name | ) |
|
Remove a member from the schema.
- Parameters
-
| name | The member to remove. |
◆ replaceMember()
| void Parsnip::DictionarySchema::replaceMember |
( |
const char * |
name, |
|
|
const SchemaBase & |
schema |
|
) |
| |
Replace a member in the schema, retaining original mandatory status and dependencies.
- Parameters
-
| name | The member to revise. |
| schema | The replacement schema for the member. |
◆ validate()
| void Parsnip::DictionarySchema::validate |
( |
const Parsnip::Data & |
entry | ) |
const |
|
overridevirtual |
Validate a dictionary:
- Check all elements conform to their respected schema.
- Ensure all mandatory elements are present.
- Ensure there are no unknown elements present.
- Make sure any co-dependent keys are present.
Implements Parsnip::SchemaBase.
◆ KeywordEvaluator
◆ OptionEvaluator
◆ RemainingValuesEvaluator
◆ ValueEvaluator
◆ additional_member_regex
| SchemaRegex Parsnip::DictionarySchema::additional_member_regex |
|
protected |
◆ additional_member_schema
| SchemaBaseRef Parsnip::DictionarySchema::additional_member_schema |
|
protected |
◆ maximum_members
| size_type Parsnip::DictionarySchema::maximum_members = std::numeric_limits<size_type>::max() |
|
private |
◆ members
◆ minimum_members
| size_type Parsnip::DictionarySchema::minimum_members {0} |
|
private |
◆ NoDependencies
| const Dependencies Parsnip::DictionarySchema::NoDependencies |
|
static |
◆ tolerance
Allow unrecognized members in the dictionary?
The documentation for this class was generated from the following files: