CLI11
C++11 Command Line Interface Parser
|
Translate named items to other or a value set. More...
#include <Validators.hpp>
Public Types | |
using | filter_fn_t = std::function< std::string(std::string)> |
Public Member Functions | |
template<typename... Args> | |
Transformer (std::initializer_list< std::pair< std::string, std::string >> values, Args &&... args) | |
This allows in-place construction. | |
template<typename T > | |
Transformer (T &&mapping) | |
direct map of std::string to std::string | |
template<typename T , typename F > | |
Transformer (T mapping, F filter_function) | |
template<typename T , typename... Args> | |
Transformer (T &&mapping, filter_fn_t filter_fn_1, filter_fn_t filter_fn_2, Args &&... other) | |
You can pass in as many filter functions as you like, they nest. | |
![]() | |
Validator (std::string validator_desc) | |
Construct a Validator with just the description string. | |
Validator (std::function< std::string(std::string &)> op, std::string validator_desc, std::string validator_name="") | |
Validator & | operation (std::function< std::string(std::string &)> op) |
Set the Validator operation function. | |
std::string | operator() (std::string &str) const |
std::string | operator() (const std::string &str) const |
Validator & | description (std::string validator_desc) |
Specify the type string. | |
std::string | get_description () const |
Generate type description information for the Validator. | |
Validator & | name (std::string validator_name) |
Specify the type string. | |
const std::string & | get_name () const |
Get the name of the Validator. | |
Validator & | active (bool active_val=true) |
Specify whether the Validator is active or not. | |
Validator & | non_modifying (bool no_modify=true) |
Specify whether the Validator can be modifying or not. | |
bool | get_active () const |
Get a boolean if the validator is active. | |
bool | get_modifying () const |
Get a boolean if the validator is allowed to modify the input returns true if it can modify the input. | |
Validator | operator & (const Validator &other) const |
Validator | operator| (const Validator &other) const |
Validator | operator! () const |
Create a validator that fails when a given validator succeeds. | |
Additional Inherited Members | |
![]() | |
std::function< std::string()> | desc_function_ {[]() { return std::string{}; }} |
This is the description function, if empty the description_ will be used. | |
std::function< std::string(std::string &)> | func_ {[](std::string &) { return std::string{}; }} |
std::string | name_ |
The name for search purposes of the Validator. | |
bool | active_ {true} |
Enable for Validator to allow it to be disabled if need be. | |
bool | non_modifying_ {false} |
specify that a validator should not modify the input | |
Translate named items to other or a value set.
|
inlineexplicit |
This checks to see if an item is in a set: pointer or copy version. You can pass in a function that will filter both sides of the comparison before computing the comparison.