![]() |
advgetopt 2.0.47
Parse complex command line arguments and configuration files in C++.
|
#include <validator.h>
Public Types | |
typedef std::shared_ptr< validator > | pointer_t |
typedef std::vector< pointer_t > | vector_t |
Public Member Functions | |
virtual | ~validator () |
The validator destructor to support virtuals. | |
virtual std::string | name () const =0 |
Return the name of the validator. | |
virtual bool | validate (std::string const &value) const =0 |
Return true if value validates agains this validator. | |
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) |
Definition at line 61 of file validator.h.
typedef std::shared_ptr<validator> advgetopt::validator::pointer_t |
Definition at line 64 of file validator.h.
typedef std::vector<pointer_t> advgetopt::validator::vector_t |
Definition at line 65 of file validator.h.
|
virtual |
This destructor is defined so virtual functions work as expected including the deleter.
Definition at line 540 of file validator.cpp.
|
static |
Definition at line 589 of file validator.cpp.
References name(), and advgetopt::option_flags_merge().
Referenced by create(), and advgetopt::option_info::set_validator().
|
static |
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:
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.
[in] | name_and_params | The validator name and parameters. |
Definition at line 626 of file validator.cpp.
References create(), and advgetopt::option_flags_merge().
|
pure virtual |
The name() function is used to get the name of the validator. Validators are recognized by name and added to your options using their name.
Note that when an option specifies a validator which it can't find, then an error occurs.
Implemented in advgetopt::validator_double, advgetopt::validator_duration, advgetopt::validator_email, advgetopt::validator_integer, advgetopt::validator_keywords, advgetopt::validator_length, advgetopt::validator_list, advgetopt::validator_regex, and advgetopt::validator_size.
Referenced by create().
|
static |
Definition at line 571 of file validator.cpp.
References advgetopt::option_flags_merge().
The function parses the value
parameter and if it matches the allowed parameters, then it returns true.
[in] | value | The value to validate. |
Implemented in advgetopt::validator_double, advgetopt::validator_duration, advgetopt::validator_email, advgetopt::validator_integer, advgetopt::validator_keywords, advgetopt::validator_length, advgetopt::validator_list, advgetopt::validator_regex, and advgetopt::validator_size.
This document is part of the Snap! Websites Project.
Copyright by Made to Order Software Corp.