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

Evaluate a string value field. More...

#include <parsnip_evaluate.h>

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

Public Member Functions

virtual Parsnip::Data evaluateToken (ArgvCursor *cursor) const override
 
virtual bool operator== (const Evaluator &other) const override
 Check if two evaluators are the same. More...
 
virtual SchemaBasegetSchema () const override final
 
- Public Member Functions inherited from Parsnip::ValueEvaluator
virtual void convertToOptionEvaluator () override
 Make any changes to the parse tree to convert it to an options evaluator. More...
 
virtual void constructSchema (const DictionarySchema &scheme, const Schema::OptionSchemas &option_schemas, const SchemaIntegratorCallback &integrator) const override
 Construct a schema from an evaluator tree. More...
 
 Evaluator ()=default
 
 Evaluator (Evaluator *original)
 Upgrade an evaluator. More...
 
- Public Member Functions inherited from Parsnip::Evaluator
 Evaluator (Evaluator *original)
 Upgrade an evaluator. More...
 
virtual ~Evaluator ()=default
 
int evaluate (ArgvCursor *cursor, Parsnip::Data &result_dict)
 Evaluate a token in the command line, and recurse if there is more to go. More...
 
bool operator!= (const Evaluator &other) const
 

Static Public Member Functions

static RegExEvaluatorconstruct (EvaluatorRef &evaluator, const std::string &name, const StringType &expression, const bool case_blind)
 Construct an evaluator (or validate the existing validator) for accepting an integer with a limited range. More...
 
- Static Public Member Functions inherited from Parsnip::ValueEvaluator
static void construct (EvaluatorRef &parser, const ArgvCursor &cursor, CommandId id, Parser *parent_parser, std::string name, std::string keywords)
 Construct a value/fill-in token handler. More...
 
- Static Public Member Functions inherited from Parsnip::Evaluator
static void construct (EvaluatorRef &evaluator, const ArgvCursor &cursor, CommandId id, Parser *parent_parser)
 Construct token handler from the token in a parsing definition. More...
 

Private Types

using RegexType = std::basic_regex< StringType::value_type >
 

Private Attributes

StringType expression
 The string defining the regular expression. More...
 
RegexType regex
 The compiled regular expression. More...
 

Additional Inherited Members

- Public Types inherited from Parsnip::Evaluator
using StringType = std::string
 
using CommandId = int
 
- Protected Member Functions inherited from Parsnip::ValueEvaluator
virtual EvaluatorgetNextEvaluator (const StringType &value) const override
 Determine if and how to evaluate additional command line tokens. More...
 
- Protected Member Functions inherited from Parsnip::Evaluator
 Evaluator ()=default
 
void setCommandId (CommandId id)
 Set the command ID in an evaluator. More...
 
- Static Protected Member Functions inherited from Parsnip::Evaluator
static void set_name (EvaluatorRef &target, const std::string &name)
 Assign a name by which to store values for value evaluators. More...
 
- Protected Attributes inherited from Parsnip::ValueEvaluator
EvaluatorRef next_evaluator
 
- Protected Attributes inherited from Parsnip::Evaluator
CommandId command_id {NoCommand}
 If this completes a command, the command ID. More...
 
std::string name
 If not empty, the name by which this value shall be accessed. More...
 

Detailed Description

Evaluate a string value field.

Member Typedef Documentation

◆ RegexType

using Parsnip::RegExEvaluator::RegexType = std::basic_regex <StringType::value_type>
private

Member Function Documentation

◆ construct()

RegExEvaluator * Parsnip::RegExEvaluator::construct ( EvaluatorRef evaluator,
const std::string &  name,
const StringType expression,
const bool  case_blind 
)
static

Construct an evaluator (or validate the existing validator) for accepting an integer with a limited range.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ evaluateToken()

Parsnip::Data Parsnip::RegExEvaluator::evaluateToken ( ArgvCursor cursor) const
overridevirtual
Returns
the current token as string data, after validating it against a regular expression.

Reimplemented from Parsnip::StringEvaluator.

◆ getSchema()

SchemaBase * Parsnip::RegExEvaluator::getSchema ( ) const
finaloverridevirtual

Reimplemented from Parsnip::StringEvaluator.

◆ operator==()

bool Parsnip::RegExEvaluator::operator== ( const Evaluator other) const
overridevirtual

Check if two evaluators are the same.

Subclasses should override this to check their details.

Parameters
otherAnother evaluator to which to compare.

Reimplemented from Parsnip::ValueEvaluator.

Member Data Documentation

◆ expression

StringType Parsnip::RegExEvaluator::expression
private

The string defining the regular expression.

◆ regex

RegexType Parsnip::RegExEvaluator::regex
private

The compiled regular expression.


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