Schema component accepting strings with certain values.
More...
#include <parsnip_schema.h>
Schema component accepting strings with certain values.
◆ KeywordSchema() [1/5]
| Parsnip::KeywordSchema::KeywordSchema |
( |
| ) |
|
|
default |
◆ KeywordSchema() [2/5]
◆ KeywordSchema() [3/5]
◆ KeywordSchema() [4/5]
| Parsnip::KeywordSchema::KeywordSchema |
( |
const std::string & |
word | ) |
|
Construct a keyword schema, starting with one initial keyword.
◆ KeywordSchema() [5/5]
| Parsnip::KeywordSchema::KeywordSchema |
( |
const Parsnip::Data & |
schema_spec | ) |
|
Construct a keyword (string enumeration) schema from a specification.
◆ addKeyword()
| void Parsnip::KeywordSchema::addKeyword |
( |
const std::string & |
word | ) |
|
Add an additional keyword that the schema will allow.
- Parameters
-
| word | The keyword to allow. |
◆ createCopy()
Create an identical, deep copy of the schema.
Caller is responsible for deleting it.
Implements Parsnip::SchemaBase.
◆ dump()
| std::ostream & Parsnip::KeywordSchema::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::KeywordSchema::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::KeywordSchema::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.
◆ validate()
| void Parsnip::KeywordSchema::validate |
( |
const Parsnip::Data & |
entry | ) |
const |
|
overridevirtual |
Validate a Keyword: ensure the datatype is a string, and that it matches one of the allowed values.
Implements Parsnip::SchemaBase.
◆ ignore_case
| bool Parsnip::KeywordSchema::ignore_case = true |
|
private |
◆ valid_values
| std::set<StringType> Parsnip::KeywordSchema::valid_values |
|
private |
The documentation for this class was generated from the following files: