HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pxr_CLI::CLI::Validator Class Reference

Some validators that are provided. More...

#include <CLI11.h>

+ Inheritance diagram for pxr_CLI::CLI::Validator:

Public Member Functions

 Validator ()=default
 
 Validator (std::string validator_desc)
 Construct a Validator with just the description string. More...
 
 func_ (std::move(op))
 
 name_ (std::move(validator_name))
 
Validatoroperation (std::function< std::string(std::string &)> op)
 Set the Validator operation function. More...
 
std::string operator() (std::string &str) const
 
std::string operator() (const std::string &str) const
 
Validatordescription (std::string validator_desc)
 Specify the type string. More...
 
CLI11_NODISCARD Validator description (std::string validator_desc) const
 Specify the type string. More...
 
CLI11_NODISCARD std::string get_description () const
 Generate type description information for the Validator. More...
 
Validatorname (std::string validator_name)
 Specify the type string. More...
 
CLI11_NODISCARD Validator name (std::string validator_name) const
 Specify the type string. More...
 
CLI11_NODISCARD const std::stringget_name () const
 Get the name of the Validator. More...
 
Validatoractive (bool active_val=true)
 Specify whether the Validator is active or not. More...
 
CLI11_NODISCARD Validator active (bool active_val=true) const
 Specify whether the Validator is active or not. More...
 
Validatornon_modifying (bool no_modify=true)
 Specify whether the Validator can be modifying or not. More...
 
Validatorapplication_index (int app_index)
 Specify the application index of a validator. More...
 
CLI11_NODISCARD Validator application_index (int app_index) const
 Specify the application index of a validator. More...
 
CLI11_NODISCARD int get_application_index () const
 Get the current value of the application index. More...
 
CLI11_NODISCARD bool get_active () const
 Get a boolean if the validator is active. More...
 
CLI11_NODISCARD bool get_modifying () const
 Get a boolean if the validator is allowed to modify the input returns true if it can modify the input. More...
 
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. More...
 

Protected Member Functions

 Validator (std::string validator_desc, std::function< std::string(std::string &)> func)
 
 func_ (std::move(func))
 

Protected Attributes

std::function< std::string()> desc_function_ {[]() { return std::string{}; }}
 This is the description function, if empty the description_ will be used. More...
 
std::function< std::string(std::string &)> func_ {[](std::string &) { return std::string{}; }}
 
std::string name_ {}
 The name for search purposes of the Validator. More...
 
int application_index_ = -1
 A Validator will only apply to an indexed value (-1 is all elements) More...
 
bool active_ {true}
 Enable for Validator to allow it to be disabled if need be. More...
 
bool non_modifying_ {false}
 specify that a validator should not modify the input More...
 

Detailed Description

Some validators that are provided.

These are simple std::string(const std::string&) validators that are useful. They return a string if the validation fails. A custom struct is provided, as well, with the same user semantics, but with the ability to provide a new type name.

Definition at line 2830 of file CLI11.h.

Constructor & Destructor Documentation

pxr_CLI::CLI::Validator::Validator ( std::string  validator_desc,
std::function< std::string(std::string &)>  func 
)
inlineprotected

Definition at line 2847 of file CLI11.h.

pxr_CLI::CLI::Validator::Validator ( )
default
pxr_CLI::CLI::Validator::Validator ( std::string  validator_desc)
inlineexplicit

Construct a Validator with just the description string.

Definition at line 2853 of file CLI11.h.

Member Function Documentation

Validator& pxr_CLI::CLI::Validator::active ( bool  active_val = true)
inline

Specify whether the Validator is active or not.

Definition at line 2903 of file CLI11.h.

CLI11_NODISCARD Validator pxr_CLI::CLI::Validator::active ( bool  active_val = true) const
inline

Specify whether the Validator is active or not.

Definition at line 2908 of file CLI11.h.

Validator& pxr_CLI::CLI::Validator::application_index ( int  app_index)
inline

Specify the application index of a validator.

Definition at line 2920 of file CLI11.h.

CLI11_NODISCARD Validator pxr_CLI::CLI::Validator::application_index ( int  app_index) const
inline

Specify the application index of a validator.

Definition at line 2925 of file CLI11.h.

Validator& pxr_CLI::CLI::Validator::description ( std::string  validator_desc)
inline

Specify the type string.

Definition at line 2875 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE Validator pxr_CLI::CLI::Validator::description ( std::string  validator_desc) const

Specify the type string.

Definition at line 3668 of file CLI11.h.

pxr_CLI::CLI::Validator::func_ ( std::  movefunc)
inlineprotected

Definition at line 2848 of file CLI11.h.

pxr_CLI::CLI::Validator::func_ ( std::  moveop)
CLI11_NODISCARD bool pxr_CLI::CLI::Validator::get_active ( ) const
inline

Get a boolean if the validator is active.

Definition at line 2933 of file CLI11.h.

CLI11_NODISCARD int pxr_CLI::CLI::Validator::get_application_index ( ) const
inline

Get the current value of the application index.

Definition at line 2931 of file CLI11.h.

CLI11_NODISCARD std::string pxr_CLI::CLI::Validator::get_description ( ) const
inline

Generate type description information for the Validator.

Definition at line 2883 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::Validator::get_modifying ( ) const
inline

Get a boolean if the validator is allowed to modify the input returns true if it can modify the input.

Definition at line 2936 of file CLI11.h.

CLI11_NODISCARD const std::string& pxr_CLI::CLI::Validator::get_name ( ) const
inline

Get the name of the Validator.

Definition at line 2901 of file CLI11.h.

Validator& pxr_CLI::CLI::Validator::name ( std::string  validator_name)
inline

Specify the type string.

Definition at line 2890 of file CLI11.h.

CLI11_NODISCARD Validator pxr_CLI::CLI::Validator::name ( std::string  validator_name) const
inline

Specify the type string.

Definition at line 2895 of file CLI11.h.

pxr_CLI::CLI::Validator::name_ ( std::  movevalidator_name)
inline

Definition at line 2857 of file CLI11.h.

Validator& pxr_CLI::CLI::Validator::non_modifying ( bool  no_modify = true)
inline

Specify whether the Validator can be modifying or not.

Definition at line 2915 of file CLI11.h.

Validator& pxr_CLI::CLI::Validator::operation ( std::function< std::string(std::string &)>  op)
inline

Set the Validator operation function.

Definition at line 2859 of file CLI11.h.

CLI11_INLINE Validator pxr_CLI::CLI::Validator::operator! ( void  ) const

Create a validator that fails when a given validator succeeds.

Definition at line 3718 of file CLI11.h.

CLI11_INLINE Validator pxr_CLI::CLI::Validator::operator& ( const Validator other) const

Combining validators is a new validator. Type comes from left validator if function, otherwise only set if the same.

Definition at line 3674 of file CLI11.h.

CLI11_INLINE std::string pxr_CLI::CLI::Validator::operator() ( std::string str) const

This is the required operator for a Validator - provided to help users (CLI11 uses the member func directly)

Definition at line 3655 of file CLI11.h.

std::string pxr_CLI::CLI::Validator::operator() ( const std::string str) const
inline

This is the required operator for a Validator - provided to help users (CLI11 uses the member func directly)

Definition at line 2869 of file CLI11.h.

CLI11_INLINE Validator pxr_CLI::CLI::Validator::operator| ( const Validator other) const

Combining validators is a new validator. Type comes from left validator if function, otherwise only set if the same.

Definition at line 3696 of file CLI11.h.

Member Data Documentation

bool pxr_CLI::CLI::Validator::active_ {true}
protected

Enable for Validator to allow it to be disabled if need be.

Definition at line 2843 of file CLI11.h.

int pxr_CLI::CLI::Validator::application_index_ = -1
protected

A Validator will only apply to an indexed value (-1 is all elements)

Definition at line 2841 of file CLI11.h.

std::function<std::string()> pxr_CLI::CLI::Validator::desc_function_ {[]() { return std::string{}; }}
protected

This is the description function, if empty the description_ will be used.

Definition at line 2833 of file CLI11.h.

std::function<std::string(std::string &)> pxr_CLI::CLI::Validator::func_ {[](std::string &) { return std::string{}; }}
protected

This is the base function that is to be called. Returns a string error message if validation fails.

Definition at line 2837 of file CLI11.h.

std::string pxr_CLI::CLI::Validator::name_ {}
protected

The name for search purposes of the Validator.

Definition at line 2839 of file CLI11.h.

bool pxr_CLI::CLI::Validator::non_modifying_ {false}
protected

specify that a validator should not modify the input

Definition at line 2845 of file CLI11.h.


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