Envision
A visual programming IDE for object-oriented languages
List of all members | Classes | Public Types | Public Member Functions | Private Types | Static Private Member Functions | Private Attributes
InformationScripting::ArgumentRule Class Reference

Classes

class  ArgumentValueCheck
 

Public Types

enum  RuleType { RequireAll , RequireOneOf , AtMostOneOf }
 

Public Member Functions

 ArgumentRule (RuleType rule, std::vector< ArgumentValue > expectedArguments)
 
void check (const ArgumentParser &parser) const
 Checks if this rule is satisfied, if not it throws an exception. More...
 

Private Types

using RuleFunction = std::function< bool(const ArgumentParser &, const std::vector< ArgumentValue > &)>
 

Static Private Member Functions

static bool atMostOneOf (const ArgumentParser &parser, const std::vector< ArgumentValue > &values)
 
static bool requireAll (const ArgumentParser &parser, const std::vector< ArgumentValue > &values)
 
static bool requireOneOf (const ArgumentParser &parser, const std::vector< ArgumentValue > &values)
 

Private Attributes

std::function< bool(const ArgumentParser &)> check_
 
QString violationMessage_
 

Member Typedef Documentation

◆ RuleFunction

using InformationScripting::ArgumentRule::RuleFunction = std::function<bool (const ArgumentParser&, const std::vector<ArgumentValue>&)>
private

Member Enumeration Documentation

◆ RuleType

Enumerator
RequireAll 
RequireOneOf 
AtMostOneOf 

Constructor & Destructor Documentation

◆ ArgumentRule()

InformationScripting::ArgumentRule::ArgumentRule ( RuleType  rule,
std::vector< ArgumentValue expectedArguments 
)

Member Function Documentation

◆ atMostOneOf()

bool InformationScripting::ArgumentRule::atMostOneOf ( const ArgumentParser parser,
const std::vector< ArgumentValue > &  values 
)
staticprivate

◆ check()

void InformationScripting::ArgumentRule::check ( const ArgumentParser parser) const

Checks if this rule is satisfied, if not it throws an exception.

◆ requireAll()

bool InformationScripting::ArgumentRule::requireAll ( const ArgumentParser parser,
const std::vector< ArgumentValue > &  values 
)
staticprivate

◆ requireOneOf()

bool InformationScripting::ArgumentRule::requireOneOf ( const ArgumentParser parser,
const std::vector< ArgumentValue > &  values 
)
staticprivate

Member Data Documentation

◆ check_

std::function<bool (const ArgumentParser&)> InformationScripting::ArgumentRule::check_
private

◆ violationMessage_

QString InformationScripting::ArgumentRule::violationMessage_
private