pianod2
multisource multiuser scriptable networked music player
Public Member Functions | Private Types | Private Attributes | List of all members
Parsnip::IntegerSchema Class Reference

#include <parsnip_schema.h>

Inheritance diagram for Parsnip::IntegerSchema:
Inheritance graph
[legend]
Collaboration diagram for Parsnip::IntegerSchema:
Collaboration graph
[legend]

Public Member Functions

 IntegerSchema (const Parsnip::Data &schema_spec)
 Construct an integer schema from a schema specification. More...
 
virtual IntegerSchemacreateCopy () const override
 Create an identical, deep copy of the schema. More...
 
virtual bool operator== (const SchemaBase &other) const override
 Check if two schemas perform the same validation. More...
 
virtual void validate (const Parsnip::Data &entry) const override
 Validate item range: ensure the datatype falls within the allowed range. More...
 
- Public Member Functions inherited from Parsnip::RangeSchema< long >
 RangeSchema (const long min=std::numeric_limits< long >::lowest(), const long max=std::numeric_limits< long >::max())
 Construct a numeric schema from a schema definition. More...
 
 RangeSchema ()=default
 
 RangeSchema (const RangeSchema &)=default
 
 RangeSchema (RangeSchema &&)=default
 
 RangeSchema (const Parsnip::Data &schema_spec)
 Construct a numeric schema from a schema definition. More...
 
RangeSchemaoperator= (const RangeSchema &)=default
 
RangeSchemaoperator= (RangeSchema &&)=default
 
virtual void mergeSchemas (const SchemaBase &from) override
 Merge elements into the current schema. More...
 
virtual std::ostream & dump (std::ostream &target, int indent, bool suppress_ident=false) const override
 Render the schema in human-friendly text. More...
 
- Public Member Functions inherited from Parsnip::SchemaBase
virtual ~SchemaBase ()=default
 
bool operator!= (const SchemaBase &other) const
 

Private Types

using range_type = RangeSchema< long >
 

Private Attributes

value_type multiple = 0
 If non-0, valid values are a multiple of this number. More...
 

Additional Inherited Members

- Public Types inherited from Parsnip::RangeSchema< long >
using value_type = long
 
- 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 ()=default
 
 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. More...
 
void checkType (Data::Type expected, const Parsnip::Data &entry) const
 Check that Data item is an allowed type. More...
 
bool isValidlyNull (const Parsnip::Data &entry) const
 Determine if the data is Null and if that is allowed. More...
 
bool isType (Data::Type expected, const Parsnip::Data &entry) const
 Check if a data object is a particular type. More...
 
- Protected Attributes inherited from Parsnip::SchemaBase
bool nullable = false
 If true, element may be null. More...
 

Member Typedef Documentation

◆ range_type

Constructor & Destructor Documentation

◆ IntegerSchema()

Parsnip::IntegerSchema::IntegerSchema ( const Parsnip::Data schema_spec)

Construct an integer schema from a schema specification.

Here is the caller graph for this function:

Member Function Documentation

◆ createCopy()

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

Create an identical, deep copy of the schema.

Caller is responsible for deleting it.

Reimplemented from Parsnip::RangeSchema< long >.

Here is the call graph for this function:

◆ operator==()

bool Parsnip::IntegerSchema::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::RangeSchema< long >.

Here is the call graph for this function:

◆ validate()

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

Validate item range: ensure the datatype falls within the allowed range.

Reimplemented from Parsnip::RangeSchema< long >.

Here is the call graph for this function:

Member Data Documentation

◆ multiple

value_type Parsnip::IntegerSchema::multiple = 0
private

If non-0, valid values are a multiple of this number.


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