Parsnip
parsing library
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions
Parsnip::ConjunctionSchema Class Reference

A meta-schema that determines if any, all, or exactly one or none of its subschemas are valid. More...

#include <parsnip_schema.h>

Inheritance diagram for Parsnip::ConjunctionSchema:
Parsnip::SchemaBase

Public Types

enum class  Action { All , Any , ExactlyOne , Not }
 

Public Member Functions

 ConjunctionSchema (const ConjunctionSchema &)=default
 
 ConjunctionSchema (ConjunctionSchema &&)=default
 
ConjunctionSchemaoperator= (const ConjunctionSchema &)=default
 
ConjunctionSchemaoperator= (ConjunctionSchema &&)=default
 
 ConjunctionSchema (const Parsnip::Data &schema_spec)
 
virtual ConjunctionSchemacreateCopy () 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.
 

Static Public Member Functions

static bool is_conjunction (const Parsnip::Data &schema_spec)
 Checks a schema specification for a conjunction.
 

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
 
SchemaBaseoperator= (const SchemaBase &)=default
 
SchemaBaseoperator= (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.
 

Detailed Description

A meta-schema that determines if any, all, or exactly one or none of its subschemas are valid.

Also provides "not".

Member Function Documentation

◆ createCopy()

ConjunctionSchema * Parsnip::ConjunctionSchema::createCopy ( ) const
overridevirtual

Create an identical, deep copy of the schema.

Caller is responsible for deleting it.

Implements Parsnip::SchemaBase.

◆ dump()

std::ostream & Parsnip::ConjunctionSchema::dump ( std::ostream &  target,
int  indent,
bool  suppress_indent = false 
) const
overridevirtual

Render the schema in human-friendly text.

Parameters
targetWhere to write the schema.
indentAmount of indent to use.
suppress_indentFlag indicating indent was already performed.

Implements Parsnip::SchemaBase.

◆ is_conjunction()

bool Parsnip::ConjunctionSchema::is_conjunction ( const Parsnip::Data schema_spec)
static

Checks a schema specification for a conjunction.

Returns
True if a conjunction is present, false otherwise.

◆ operator==()

bool Parsnip::ConjunctionSchema::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
otherThe schema to compare to.
Returns
True if the schemas match, false otherwise.

Reimplemented from Parsnip::SchemaBase.

◆ validate()

void Parsnip::ConjunctionSchema::validate ( const Parsnip::Data entry) const
overridevirtual

Verify that Data matches the schema.

Parameters
entryThe data to validate.
Exceptions
Variousexceptions.

Implements Parsnip::SchemaBase.


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