![]() |
advgetopt 2.0.49
Parse complex command line arguments and configuration files in C++.
|
#include <validator_length.h>


Classes | |
| struct | range_t |
Public Types | |
| typedef std::shared_ptr< validator > | pointer_t |
| typedef std::vector< pointer_t > | vector_t |
Public Member Functions | |
| validator_length (string_list_t const &data) | |
| std::string const & | get_error () const |
| virtual std::string | name () const override |
| Return the name of this validator. | |
| void | set_error (std::string const &msg) const |
| virtual bool | validate (std::string const &value) const override |
| Check the value against a list of length ranges. | |
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 | |
| range_t::vector_t | f_allowed_lengths = range_t::vector_t() |
| std::string | f_error = std::string("<error undefined>") |
Definition at line 54 of file validator_length.h.
|
inherited |
Definition at line 64 of file validator.h.
|
inherited |
Definition at line 65 of file validator.h.
| advgetopt::validator_length::validator_length | ( | string_list_t const & | data | ) |
Definition at line 97 of file validator_length.cpp.
References advgetopt::validator_integer::convert_string(), f_allowed_lengths, and advgetopt::option_flags_merge().
|
staticinherited |
Definition at line 605 of file validator.cpp.
References advgetopt::validator::name(), and advgetopt::option_flags_merge().
Referenced by advgetopt::validator::create(), and advgetopt::option_info::set_validator().
|
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:
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.
The complete grammar of the name_and_params name and parameters can be written as a comma separated list of function calls, we have a special case for regex which do not require the function call. thing is pretty much anything other than the few special characters (comma, space, parenthesis, and quotes). To include a special character in thing either use a string or escape the character.
| [in] | name_and_params | The validator name and parameters. |
Definition at line 666 of file validator.cpp.
References advgetopt::validator::create(), and advgetopt::option_flags_merge().
|
inherited |
Definition at line 581 of file validator.cpp.
References advgetopt::validator::f_error.
|
overridevirtual |
This function returns "length".
Implements advgetopt::validator.
Definition at line 171 of file validator_length.cpp.
|
staticinherited |
Definition at line 587 of file validator.cpp.
References advgetopt::option_flags_merge().
Definition at line 575 of file validator.cpp.
References advgetopt::validator::f_error, and advgetopt::option_flags_merge().
Referenced by advgetopt::validator_double::validate(), advgetopt::validator_duration::validate(), advgetopt::validator_email::validate(), advgetopt::validator_integer::validate(), advgetopt::validator_keywords::validate(), validate(), advgetopt::validator_list::validate(), advgetopt::validator_regex::validate(), and advgetopt::validator_size::validate().
This function is used to verify the length of value in characters.
| [in] | value | The value to be validated. |
Implements advgetopt::validator.
Definition at line 185 of file validator_length.cpp.
References f_allowed_lengths, advgetopt::option_flags_merge(), and advgetopt::validator::set_error().
|
private |
Definition at line 74 of file validator_length.h.
Referenced by validator_length(), and validate().
|
mutableprivateinherited |
Definition at line 82 of file validator.h.
Referenced by advgetopt::validator::get_error(), and advgetopt::validator::set_error().
This document is part of the Snap! Websites Project.
Copyright by Made to Order Software Corp.