advgetopt 2.0.47
Parse complex command line arguments and configuration files in C++.
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
advgetopt::validator_list Class Reference

#include <validator_list.h>

Inheritance diagram for advgetopt::validator_list:
Inheritance graph
[legend]
Collaboration diagram for advgetopt::validator_list:
Collaboration graph
[legend]

Public Types

typedef std::shared_ptr< validator_listpointer_t
 
typedef std::vector< pointer_tvector_t
 

Public Member Functions

 validator_list (string_list_t const &data)
 
void add_validator (validator::pointer_t v)
 
virtual std::string name () const override
 Return the name of this validator.
 
virtual bool validate (std::string const &value) const override
 Check the value against all the validators for one valid one.
 

Static Public Member Functions

static pointer_t create (std::string const &name, string_list_t const &data)
 
static pointer_t create (std::string const &name_and_params)
 Set the validator for this option.
 
static void register_validator (validator_factory const &factory)
 

Private Attributes

validator::vector_t f_validators = validator::vector_t()
 

Detailed Description

Definition at line 42 of file validator_list.h.

Member Typedef Documentation

◆ pointer_t

Definition at line 46 of file validator_list.h.

◆ vector_t

Definition at line 65 of file validator.h.

Constructor & Destructor Documentation

◆ validator_list()

advgetopt::validator_list::validator_list ( string_list_t const data)

Definition at line 87 of file validator_list.cpp.

References advgetopt::option_flags_merge().

Member Function Documentation

◆ add_validator()

void advgetopt::validator_list::add_validator ( validator::pointer_t  v)

Definition at line 99 of file validator_list.cpp.

References f_validators, and advgetopt::option_flags_merge().

◆ create() [1/2]

validator::pointer_t advgetopt::validator::create ( std::string const name,
string_list_t const data 
)
staticinherited

◆ create() [2/2]

validator::pointer_t advgetopt::validator::create ( std::string const name_and_params)
staticinherited

This function parses the specified name and optional parameters and create a corresponding validator for this option.

The name_and_params string can be defined as:

virtual std::string name() const override
Return the name of this validator.
constexpr flag_t option_flags_merge()
Definition flags.h:87

The list of parameters is optional. There may be an empty, just one, or any number of parameters. How the parameters are parsed is left to the validator to decide.

If the input string is empty, the current validator, if one is installed, gets removed.

Parameters
[in]name_and_paramsThe validator name and parameters.

Definition at line 626 of file validator.cpp.

References advgetopt::validator::create(), and advgetopt::option_flags_merge().

◆ name()

std::string advgetopt::validator_list::name ( ) const
overridevirtual

This function returns "list".

Returns
"list".

Implements advgetopt::validator.

Definition at line 114 of file validator_list.cpp.

◆ register_validator()

void advgetopt::validator::register_validator ( validator_factory const factory)
staticinherited

Definition at line 571 of file validator.cpp.

References advgetopt::option_flags_merge().

◆ validate()

bool advgetopt::validator_list::validate ( std::string const value) const
overridevirtual

This function goes through the validators registered with it and if at least one of these validators returns true, then the function considers that input value as valid and it returns true.

Parameters
[in]valueThe value to be validated.
Returns
true on a match.

Implements advgetopt::validator.

Definition at line 130 of file validator_list.cpp.

References f_validators, and advgetopt::option_flags_merge().

Member Data Documentation

◆ f_validators

validator::vector_t advgetopt::validator_list::f_validators = validator::vector_t()
private

Definition at line 58 of file validator_list.h.

Referenced by add_validator(), and validate().


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

This document is part of the Snap! Websites Project.

Copyright by Made to Order Software Corp.