CLI11  1.9.0
Classes | Enumerations | Functions | Variables
CLI::detail Namespace Reference

Classes

struct  AppFriend
 This class is simply to allow tests access to App's protected functions. More...
 
struct  classify_object
 some type that is not otherwise recognized More...
 
struct  classify_object< T, typename std::enable_if< is_bool< T >::value >::type >
 Boolean values. More...
 
struct  classify_object< T, typename std::enable_if< is_vector< T >::value >::type >
 Vector type. More...
 
struct  classify_object< T, typename std::enable_if< std::is_enum< T >::value >::type >
 Enumerations. More...
 
struct  classify_object< T, typename std::enable_if< std::is_floating_point< T >::value >::type >
 Floats. More...
 
struct  classify_object< T, typename std::enable_if< std::is_integral< T >::value &&std::is_signed< T >::value &&!is_bool< T >::value &&!std::is_enum< T >::value >::type >
 Set of overloads to classify an object according to type. More...
 
struct  classify_object< T, typename std::enable_if< std::is_integral< T >::value &&std::is_unsigned< T >::value &&!is_bool< T >::value >::type >
 Unsigned integers. More...
 
struct  classify_object< T, typename std::enable_if< uncommon_type< T >::value &&type_count< T >::value==1 &&!is_direct_constructible< T, double >::value &&is_direct_constructible< T, int >::value >::type >
 Assignable from int. More...
 
struct  classify_object< T, typename std::enable_if< uncommon_type< T >::value &&type_count< T >::value==1 &&is_direct_constructible< T, double >::value &&!is_direct_constructible< T, int >::value >::type >
 Assignable from double. More...
 
struct  classify_object< T, typename std::enable_if< uncommon_type< T >::value &&type_count< T >::value==1 &&is_direct_constructible< T, double >::value &&is_direct_constructible< T, int >::value >::type >
 Assignable from double or int. More...
 
struct  classify_object< T, typename std::enable_if<!std::is_floating_point< T >::value &&!std::is_integral< T >::value &&!std::is_assignable< T &, std::string >::value &&std::is_constructible< T, std::string >::value &&!is_vector< T >::value >::type >
 String and similar constructible and copy assignment. More...
 
struct  classify_object< T, typename std::enable_if<!std::is_floating_point< T >::value &&!std::is_integral< T >::value &&std::is_assignable< T &, std::string >::value &&!is_vector< T >::value >::type >
 String and similar direct assignment. More...
 
struct  element_type
 not a pointer More...
 
struct  element_type< T, typename std::enable_if< is_copyable_ptr< T >::value >::type >
 
struct  element_value_type
 
class  ExistingDirectoryValidator
 Check for an existing directory (returns error message if check fails) More...
 
class  ExistingFileValidator
 Check for an existing file (returns error message if check fails) More...
 
class  ExistingPathValidator
 Check for an existing path. More...
 
struct  expected_count
 This will only trigger for actual void type. More...
 
struct  expected_count< T, typename std::enable_if< is_vector< T >::value >::type >
 number of expected items in a vector More...
 
struct  expected_count< T, typename std::enable_if<!is_vector< T >::value &&!std::is_void< T >::value >::type >
 For most types the number of expected items is 1. More...
 
struct  has_find
 
class  IPV4Validator
 Validate the given string is a legal ipv4 address. More...
 
class  is_direct_constructible
 
class  is_istreamable
 Check for input streamability. More...
 
class  is_ostreamable
 
class  is_tuple_like
 
class  NonexistentPathValidator
 Check for an non-existing path. More...
 
class  NonNegativeNumber
 Validate the argument is a number and greater than or equal to 0. More...
 
class  Number
 Validate the argument is a number. More...
 
struct  pair_adaptor
 Adaptor for set-like structure: This just wraps a normal container in a few utilities that do almost nothing. More...
 
struct  pair_adaptor< T, conditional_t< false, void_t< typename T::value_type::first_type, typename T::value_type::second_type >, void > >
 
class  PositiveNumber
 Validate the argument is a number and greater than 0. More...
 
struct  type_count
 This will only trigger for actual void type. More...
 
struct  type_count< T, typename std::enable_if< is_tuple_like< T >::value >::type >
 Set of overloads to get the type size of an object. More...
 
struct  type_count< T, typename std::enable_if< is_vector< T >::value >::type >
 Type size of types that look like a vector. More...
 
struct  type_count< T, typename std::enable_if<!is_vector< T >::value &&!is_tuple_like< T >::value &&!std::is_void< T >::value >::type >
 Type size for regular object types that do not look like a tuple. More...
 
struct  uncommon_type
 

Enumerations

enum  Classifier {
  Classifier::NONE, Classifier::POSITIONAL_MARK, Classifier::SHORT, Classifier::LONG,
  Classifier::WINDOWS, Classifier::SUBCOMMAND, Classifier::SUBCOMMAND_TERMINATOR
}
 
enum  enabler
 Simple empty scoped class. More...
 
enum  object_category : int {
  object_category::integral_value = 2, object_category::unsigned_integral = 4, object_category::enumeration = 6, object_category::boolean_value = 8,
  object_category::floating_point = 10, object_category::number_constructible = 12, object_category::double_constructible = 14, object_category::integer_constructible = 16,
  object_category::vector_value = 30, object_category::tuple_value = 35, object_category::string_assignable = 50, object_category::string_constructible = 60,
  object_category::other = 200
}
 
enum  path_type { path_type::nonexistant, path_type::file, path_type::directory }
 CLI enumeration of different file types. More...
 

Functions

std::string convert_arg_for_ini (const std::string &arg)
 
std::string ini_join (const std::vector< std::string > &args, char sepChar=',', char arrayStart='[', char arrayEnd=']')
 Comma separated join, adds quotes if needed. More...
 
std::vector< std::string > generate_parents (const std::string &section, std::string &name)
 
void checkParentSegments (std::vector< ConfigItem > &output, const std::string &currentSection)
 assuming non default segments do a check on the close and open of the segments in a configItem structure More...
 
bool split_short (const std::string &current, std::string &name, std::string &rest)
 
bool split_long (const std::string &current, std::string &name, std::string &value)
 
bool split_windows_style (const std::string &current, std::string &name, std::string &value)
 
std::vector< std::string > split_names (std::string current)
 
std::vector< std::pair< std::string, std::string > > get_default_flag_values (const std::string &str)
 extract default flag values either {def} or starting with a ! More...
 
std::tuple< std::vector< std::string >, std::vector< std::string >, std::string > get_names (const std::vector< std::string > &input)
 Get a vector of short names, one of long names, and a single name. More...
 
std::vector< std::string > split (const std::string &s, char delim)
 Split a string by a delim. More...
 
template<typename T >
std::string join (const T &v, std::string delim=",")
 Simple function to join a string. More...
 
template<typename T , typename Callable , typename = typename std::enable_if<!std::is_constructible<std::string, Callable>::value>::type>
std::string join (const T &v, Callable func, std::string delim=",")
 Simple function to join a string from processed elements. More...
 
template<typename T >
std::string rjoin (const T &v, std::string delim=",")
 Join a string in reverse order. More...
 
std::string & ltrim (std::string &str)
 Trim whitespace from left of string. More...
 
std::string & ltrim (std::string &str, const std::string &filter)
 Trim anything from left of string. More...
 
std::string & rtrim (std::string &str)
 Trim whitespace from right of string. More...
 
std::string & rtrim (std::string &str, const std::string &filter)
 Trim anything from right of string. More...
 
std::string & trim (std::string &str)
 Trim whitespace from string. More...
 
std::string & trim (std::string &str, const std::string filter)
 Trim anything from string. More...
 
std::string trim_copy (const std::string &str)
 Make a copy of the string and then trim it. More...
 
std::string & remove_quotes (std::string &str)
 remove quotes at the front and back of a string either '"' or '\'' More...
 
std::string trim_copy (const std::string &str, const std::string &filter)
 Make a copy of the string and then trim it, any filter string can be used (any char in string is filtered) More...
 
std::ostream & format_help (std::ostream &out, std::string name, std::string description, std::size_t wid)
 Print a two part "help" string. More...
 
template<typename T >
bool valid_first_char (T c)
 Verify the first character of an option. More...
 
template<typename T >
bool valid_later_char (T c)
 Verify following characters of an option. More...
 
bool valid_name_string (const std::string &str)
 Verify an option name. More...
 
bool isalpha (const std::string &str)
 Verify that str consists of letters only. More...
 
std::string to_lower (std::string str)
 Return a lower case version of a string. More...
 
std::string remove_underscore (std::string str)
 remove underscores from a string More...
 
std::string find_and_replace (std::string str, std::string from, std::string to)
 Find and replace a substring with another substring. More...
 
bool has_default_flag_values (const std::string &flags)
 check if the flag definitions has possible false flags More...
 
void remove_default_flag_values (std::string &flags)
 
std::ptrdiff_t find_member (std::string name, const std::vector< std::string > names, bool ignore_case=false, bool ignore_underscore=false)
 Check if a string is a member of a list of strings and optionally ignore case or ignore underscores. More...
 
template<typename Callable >
std::string find_and_modify (std::string str, std::string trigger, Callable modify)
 
std::vector< std::string > split_up (std::string str, char delimiter='\0')
 
std::string fix_newlines (const std::string &leader, std::string input)
 
std::size_t escape_detect (std::string &str, std::size_t offset)
 
std::string & add_quotes_if_needed (std::string &str)
 Add quotes if the string contains spaces. More...
 
template<typename T , enable_if_t< is_istreamable< T >::value, detail::enabler > = detail::dummy>
bool from_stream (const std::string &istring, T &obj)
 Templated operation to get a value from a stream. More...
 
template<typename T , enable_if_t< std::is_constructible< std::string, T >::value, detail::enabler > = detail::dummy>
auto to_string (T &&value) -> decltype(std::forward< T >(value))
 Convert an object to a string (directly forward if this can become a string) More...
 
template<typename T , enable_if_t<!std::is_constructible< std::string, T >::value &&is_ostreamable< T >::value, detail::enabler > = detail::dummy>
std::string to_string (T &&value)
 Convert an object to a string (streaming must be supported for that type) More...
 
template<typename T1 , typename T2 , typename T , enable_if_t< std::is_same< T1, T2 >::value, detail::enabler > = detail::dummy>
auto checked_to_string (T &&value) -> decltype(to_string(std::forward< T >(value)))
 special template overload More...
 
template<typename T1 , typename T2 , typename T , enable_if_t<!std::is_same< T1, T2 >::value, detail::enabler > = detail::dummy>
std::string checked_to_string (T &&)
 special template overload More...
 
template<typename T , enable_if_t< std::is_arithmetic< T >::value, detail::enabler > = detail::dummy>
std::string value_string (const T &value)
 get a string as a convertible value for arithmetic types More...
 
template<typename T , enable_if_t<!std::is_enum< T >::value &&!std::is_arithmetic< T >::value, detail::enabler > = detail::dummy>
auto value_string (const T &value) -> decltype(to_string(value))
 for other types just use the regular to_string function More...
 
template<typename T , enable_if_t< classify_object< T >::value==object_category::integral_value||classify_object< T >::value==object_category::integer_constructible, detail::enabler > = detail::dummy>
constexpr const char * type_name ()
 Print name for enumeration types. More...
 
std::size_t I std::enable_if< I==type_count< T >::value, std::string >::type tuple_name ()
 
template<typename T , std::size_t I>
std::enable_if< I< type_count< T >::value, std::string >::type tuple_name() { std::string str=std::string(type_name< typename std::tuple_element< I, T >::type >))+','+tuple_name< T, I+1 >);if(str.back()==',') str.pop_back();return str;}template< typename T, enable_if_t< classify_object< T >::value==object_category::tuple_value &&type_count< T >::value >=2, detail::enabler >=detail::dummy > std::string type_name ()
 Recursively generate the tuple type name. More...
 
template<typename T , enable_if_t< classify_object< T >::value==object_category::vector_value, detail::enabler > = detail::dummy>
std::string type_name ()
 This one should not be used normally, since vector types print the internal type. More...
 
int64_t to_flag_value (std::string val)
 Convert a flag into an integer value typically binary flags. More...
 
template<typename T , enable_if_t< classify_object< T >::value==object_category::integral_value, detail::enabler > = detail::dummy>
bool lexical_cast (const std::string &input, T &output)
 Signed integers. More...
 
template<typename T , typename XC , enable_if_t< std::is_same< T, XC >::value &&(classify_object< T >::value==object_category::string_assignable||classify_object< T >::value==object_category::string_constructible), detail::enabler > = detail::dummy>
bool lexical_assign (const std::string &input, T &output)
 Assign a value through lexical cast operations. More...
 
template<typename T , typename XC , enable_if_t<!is_tuple_like< T >::value &&!is_tuple_like< XC >::value &&!is_vector< T >::value &&!is_vector< XC >::value, detail::enabler > = detail::dummy>
bool lexical_conversion (const std::vector< std ::string > &strings, T &output)
 Lexical conversion if there is only one element. More...
 
bool ::type tuple_conversion (const std::vector< std::string > &, T &)
 
path_type check_path (const char *file) noexcept
 get the type of the path from a file name More...
 
template<typename T , enable_if_t< is_copyable_ptr< typename std::remove_reference< T >::type >::value, detail::enabler > = detail::dummy>
auto smart_deref (T value) -> decltype(*value)
 
template<typename T , enable_if_t<!is_copyable_ptr< typename std::remove_reference< T >::type >::value, detail::enabler > = detail::dummy>
std::remove_reference< T >::type & smart_deref (T &value)
 
template<typename T >
std::string generate_set (const T &set)
 Generate a string representation of a set. More...
 
template<typename T >
std::string generate_map (const T &map, bool key_only=false)
 Generate a string representation of a map. More...
 
template<typename T , typename V , enable_if_t<!has_find< T, V >::value, detail::enabler > = detail::dummy>
auto search (const T &set, const V &val) -> std::pair< bool, decltype(std::begin(detail::smart_deref(set)))>
 A search function. More...
 
template<typename T , typename V >
auto search (const T &set, const V &val, const std::function< V(V)> &filter_function) -> std::pair< bool, decltype(std::begin(detail::smart_deref(set)))>
 A search function with a filter function. More...
 
template<typename T >
std::enable_if< std::is_signed< T >::value, T >::type overflowCheck (const T &a, const T &b)
 Do a check for overflow on signed numbers. More...
 
template<typename T >
std::enable_if<!std::is_signed< T >::value, T >::type overflowCheck (const T &a, const T &b)
 Do a check for overflow on unsigned numbers. More...
 
template<typename T >
std::enable_if< std::is_integral< T >::value, bool >::type checked_multiply (T &a, T b)
 Performs a *= b; if it doesn't cause integer overflow. Returns false otherwise. More...
 
template<typename T >
std::enable_if< std::is_floating_point< T >::value, bool >::type checked_multiply (T &a, T b)
 Performs a *= b; if it doesn't equal infinity. Returns false otherwise. More...
 
std::pair< std::string, std::string > split_program_name (std::string commandline)
 

Variables

constexpr int expected_max_vector_size {1 << 29}
 
constexpr enabler dummy = {}
 An instance to use in EnableIf. More...
 

Enumeration Type Documentation

◆ Classifier

Enumerator
NONE 
POSITIONAL_MARK 
SHORT 
LONG 
WINDOWS 
SUBCOMMAND 
SUBCOMMAND_TERMINATOR 

◆ enabler

enum CLI::detail::enabler
strong

Simple empty scoped class.

◆ object_category

enum CLI::detail::object_category : int
strong
Enumerator
integral_value 
unsigned_integral 
enumeration 
boolean_value 
floating_point 
number_constructible 
double_constructible 
integer_constructible 
vector_value 
tuple_value 
string_assignable 
string_constructible 
other 

◆ path_type

CLI enumeration of different file types.

Enumerator
nonexistant 
file 
directory 

Function Documentation

◆ add_quotes_if_needed()

std::string& CLI::detail::add_quotes_if_needed ( std::string &  str)
inline

Add quotes if the string contains spaces.

◆ check_path()

path_type CLI::detail::check_path ( const char *  file)
inlinenoexcept

get the type of the path from a file name

◆ checked_multiply() [1/2]

template<typename T >
std::enable_if<std::is_integral<T>::value, bool>::type CLI::detail::checked_multiply ( T &  a,
b 
)

Performs a *= b; if it doesn't cause integer overflow. Returns false otherwise.

◆ checked_multiply() [2/2]

template<typename T >
std::enable_if<std::is_floating_point<T>::value, bool>::type CLI::detail::checked_multiply ( T &  a,
b 
)

Performs a *= b; if it doesn't equal infinity. Returns false otherwise.

◆ checked_to_string() [1/2]

template<typename T1 , typename T2 , typename T , enable_if_t<!std::is_same< T1, T2 >::value, detail::enabler > = detail::dummy>
std::string CLI::detail::checked_to_string ( T &&  )

special template overload

◆ checked_to_string() [2/2]

template<typename T1 , typename T2 , typename T , enable_if_t< std::is_same< T1, T2 >::value, detail::enabler > = detail::dummy>
auto CLI::detail::checked_to_string ( T &&  value) -> decltype(to_string(std::forward<T>(value)))

special template overload

◆ checkParentSegments()

void CLI::detail::checkParentSegments ( std::vector< ConfigItem > &  output,
const std::string &  currentSection 
)
inline

assuming non default segments do a check on the close and open of the segments in a configItem structure

◆ convert_arg_for_ini()

std::string CLI::detail::convert_arg_for_ini ( const std::string &  arg)
inline

◆ escape_detect()

std::size_t CLI::detail::escape_detect ( std::string &  str,
std::size_t  offset 
)
inline

This function detects an equal or colon followed by an escaped quote after an argument then modifies the string to replace the equality with a space. This is needed to allow the split up function to work properly and is intended to be used with the find_and_modify function the return value is the offset+1 which is required by the find_and_modify function.

◆ find_and_modify()

template<typename Callable >
std::string CLI::detail::find_and_modify ( std::string  str,
std::string  trigger,
Callable  modify 
)
inline

Find a trigger string and call a modify callable function that takes the current string and starting position of the trigger and returns the position in the string to search for the next trigger string

◆ find_and_replace()

std::string CLI::detail::find_and_replace ( std::string  str,
std::string  from,
std::string  to 
)
inline

Find and replace a substring with another substring.

◆ find_member()

std::ptrdiff_t CLI::detail::find_member ( std::string  name,
const std::vector< std::string >  names,
bool  ignore_case = false,
bool  ignore_underscore = false 
)
inline

Check if a string is a member of a list of strings and optionally ignore case or ignore underscores.

◆ fix_newlines()

std::string CLI::detail::fix_newlines ( const std::string &  leader,
std::string  input 
)
inline

Add a leader to the beginning of all new lines (nothing is added at the start of the first line). "; " would be for ini files

Can't use Regex, or this would be a subs.

◆ format_help()

std::ostream& CLI::detail::format_help ( std::ostream &  out,
std::string  name,
std::string  description,
std::size_t  wid 
)
inline

Print a two part "help" string.

◆ from_stream()

template<typename T , enable_if_t< is_istreamable< T >::value, detail::enabler > = detail::dummy>
bool CLI::detail::from_stream ( const std::string &  istring,
T &  obj 
)

Templated operation to get a value from a stream.

◆ generate_map()

template<typename T >
std::string CLI::detail::generate_map ( const T &  map,
bool  key_only = false 
)

Generate a string representation of a map.

◆ generate_parents()

std::vector<std::string> CLI::detail::generate_parents ( const std::string &  section,
std::string &  name 
)
inline

◆ generate_set()

template<typename T >
std::string CLI::detail::generate_set ( const T &  set)

Generate a string representation of a set.

◆ get_default_flag_values()

std::vector<std::pair<std::string, std::string> > CLI::detail::get_default_flag_values ( const std::string &  str)
inline

extract default flag values either {def} or starting with a !

◆ get_names()

std::tuple<std::vector<std::string>, std::vector<std::string>, std::string> CLI::detail::get_names ( const std::vector< std::string > &  input)
inline

Get a vector of short names, one of long names, and a single name.

◆ has_default_flag_values()

bool CLI::detail::has_default_flag_values ( const std::string &  flags)
inline

check if the flag definitions has possible false flags

◆ ini_join()

std::string CLI::detail::ini_join ( const std::vector< std::string > &  args,
char  sepChar = ',',
char  arrayStart = '[',
char  arrayEnd = ']' 
)
inline

Comma separated join, adds quotes if needed.

◆ isalpha()

bool CLI::detail::isalpha ( const std::string &  str)
inline

Verify that str consists of letters only.

◆ join() [1/2]

template<typename T , typename Callable , typename = typename std::enable_if<!std::is_constructible<std::string, Callable>::value>::type>
std::string CLI::detail::join ( const T &  v,
Callable  func,
std::string  delim = "," 
)

Simple function to join a string from processed elements.

◆ join() [2/2]

template<typename T >
std::string CLI::detail::join ( const T &  v,
std::string  delim = "," 
)

Simple function to join a string.

◆ lexical_assign()

template<typename T , typename XC , enable_if_t< std::is_same< T, XC >::value &&(classify_object< T >::value==object_category::string_assignable||classify_object< T >::value==object_category::string_constructible), detail::enabler > = detail::dummy>
bool CLI::detail::lexical_assign ( const std::string &  input,
T &  output 
)

Assign a value through lexical cast operations.

Assign a value from a lexical cast through constructing a value and move assigning it.

Assign a value converted from a string in lexical cast to the output value directly.

◆ lexical_cast()

template<typename T , enable_if_t< classify_object< T >::value==object_category::integral_value, detail::enabler > = detail::dummy>
bool CLI::detail::lexical_cast ( const std::string &  input,
T &  output 
)

Signed integers.

Non-string parsable by a stream.

Assignable from double.

Assignable from int.

Assignable from double or int.

Enumerations.

String and similar constructible and copy assignment.

String and similar direct assignment.

Floats.

Boolean values.

Unsigned integers.

◆ lexical_conversion()

template<typename T , typename XC , enable_if_t<!is_tuple_like< T >::value &&!is_tuple_like< XC >::value &&!is_vector< T >::value &&!is_vector< XC >::value, detail::enabler > = detail::dummy>
bool CLI::detail::lexical_conversion ( const std::vector< std ::string > &  strings,
T &  output 
)

Lexical conversion if there is only one element.

Lexical conversion if there is only one element but the conversion type is a vector.

Conversion to a vector type using a particular single type as the conversion type.

Lexical conversion of a vector types with type size of two.

Lexical conversion of a vector types.

Lexical conversion if there is only one element but the conversion type is for two call a two element constructor.

◆ ltrim() [1/2]

std::string& CLI::detail::ltrim ( std::string &  str)
inline

Trim whitespace from left of string.

◆ ltrim() [2/2]

std::string& CLI::detail::ltrim ( std::string &  str,
const std::string &  filter 
)
inline

Trim anything from left of string.

◆ overflowCheck() [1/2]

template<typename T >
std::enable_if<std::is_signed<T>::value, T>::type CLI::detail::overflowCheck ( const T &  a,
const T &  b 
)
inline

Do a check for overflow on signed numbers.

◆ overflowCheck() [2/2]

template<typename T >
std::enable_if<!std::is_signed<T>::value, T>::type CLI::detail::overflowCheck ( const T &  a,
const T &  b 
)
inline

Do a check for overflow on unsigned numbers.

◆ remove_default_flag_values()

void CLI::detail::remove_default_flag_values ( std::string &  flags)
inline

◆ remove_quotes()

std::string& CLI::detail::remove_quotes ( std::string &  str)
inline

remove quotes at the front and back of a string either '"' or '\''

◆ remove_underscore()

std::string CLI::detail::remove_underscore ( std::string  str)
inline

remove underscores from a string

◆ rjoin()

template<typename T >
std::string CLI::detail::rjoin ( const T &  v,
std::string  delim = "," 
)

Join a string in reverse order.

◆ rtrim() [1/2]

std::string& CLI::detail::rtrim ( std::string &  str)
inline

Trim whitespace from right of string.

◆ rtrim() [2/2]

std::string& CLI::detail::rtrim ( std::string &  str,
const std::string &  filter 
)
inline

Trim anything from right of string.

◆ search() [1/2]

template<typename T , typename V , enable_if_t<!has_find< T, V >::value, detail::enabler > = detail::dummy>
auto CLI::detail::search ( const T &  set,
const V &  val 
) -> std::pair<bool, decltype(std::begin(detail::smart_deref(set)))>

A search function.

A search function that uses the built in find function.

◆ search() [2/2]

template<typename T , typename V >
auto CLI::detail::search ( const T &  set,
const V &  val,
const std::function< V(V)> &  filter_function 
) -> std::pair<bool, decltype(std::begin(detail::smart_deref(set)))>

A search function with a filter function.

◆ smart_deref() [1/2]

template<typename T , enable_if_t<!is_copyable_ptr< typename std::remove_reference< T >::type >::value, detail::enabler > = detail::dummy>
std::remove_reference<T>::type& CLI::detail::smart_deref ( T &  value)

◆ smart_deref() [2/2]

template<typename T , enable_if_t< is_copyable_ptr< typename std::remove_reference< T >::type >::value, detail::enabler > = detail::dummy>
auto CLI::detail::smart_deref ( value) -> decltype(*value)

◆ split()

std::vector<std::string> CLI::detail::split ( const std::string &  s,
char  delim 
)
inline

Split a string by a delim.

◆ split_long()

bool CLI::detail::split_long ( const std::string &  current,
std::string &  name,
std::string &  value 
)
inline

◆ split_names()

std::vector<std::string> CLI::detail::split_names ( std::string  current)
inline

◆ split_program_name()

std::pair<std::string, std::string> CLI::detail::split_program_name ( std::string  commandline)
inline

Split a string into a program name and command line arguments the string is assumed to contain a file name followed by other arguments the return value contains is a pair with the first argument containing the program name and the second everything else.

◆ split_short()

bool CLI::detail::split_short ( const std::string &  current,
std::string &  name,
std::string &  rest 
)
inline

◆ split_up()

std::vector<std::string> CLI::detail::split_up ( std::string  str,
char  delimiter = '\0' 
)
inline

Split a string '"one two" "three"' into 'one two', 'three' Quote characters can be ‘ ’ or "

◆ split_windows_style()

bool CLI::detail::split_windows_style ( const std::string &  current,
std::string &  name,
std::string &  value 
)
inline

◆ to_flag_value()

int64_t CLI::detail::to_flag_value ( std::string  val)
inline

Convert a flag into an integer value typically binary flags.

◆ to_lower()

std::string CLI::detail::to_lower ( std::string  str)
inline

Return a lower case version of a string.

◆ to_string() [1/2]

template<typename T , enable_if_t<!std::is_constructible< std::string, T >::value &&is_ostreamable< T >::value, detail::enabler > = detail::dummy>
std::string CLI::detail::to_string ( T &&  value)

Convert an object to a string (streaming must be supported for that type)

convert a vector to a string

If conversion is not supported, return an empty string (streaming is not supported for that type)

◆ to_string() [2/2]

template<typename T , enable_if_t< std::is_constructible< std::string, T >::value, detail::enabler > = detail::dummy>
auto CLI::detail::to_string ( T &&  value) -> decltype(std::forward<T>(value))

Convert an object to a string (directly forward if this can become a string)

◆ trim() [1/2]

std::string& CLI::detail::trim ( std::string &  str)
inline

Trim whitespace from string.

◆ trim() [2/2]

std::string& CLI::detail::trim ( std::string &  str,
const std::string  filter 
)
inline

Trim anything from string.

◆ trim_copy() [1/2]

std::string CLI::detail::trim_copy ( const std::string &  str)
inline

Make a copy of the string and then trim it.

◆ trim_copy() [2/2]

std::string CLI::detail::trim_copy ( const std::string &  str,
const std::string &  filter 
)
inline

Make a copy of the string and then trim it, any filter string can be used (any char in string is filtered)

◆ tuple_conversion()

bool ::type CLI::detail::tuple_conversion ( const std::vector< std::string > &  ,
T &   
)

◆ tuple_name()

std::size_t I std::enable_if<I == type_count<T>::value, std::string>::type CLI::detail::tuple_name ( )
inline

◆ type_name() [1/3]

template<typename T , enable_if_t< classify_object< T >::value==object_category::integral_value||classify_object< T >::value==object_category::integer_constructible, detail::enabler > = detail::dummy>
constexpr const char * CLI::detail::type_name ( )
constexpr

Print name for enumeration types.

Was going to be based on http://stackoverflow.com/questions/1055452/c-get-name-of-type-in-template But this is cleaner and works better in this case

◆ type_name() [2/3]

template<typename T , std::size_t I>
std::enable_if< I<type_count<T>::value, std::string>::type tuple_name() { std::string str = std::string(type_name<typename std::tuple_element<I, T>::type>)) + ',' + tuple_name<T, I + 1>); if(str.back() == ',') str.pop_back(); return str;}template <typename T, enable_if_t<classify_object<T>::value == object_category::tuple_value && type_count<T>::value >= 2, detail::enabler> = detail::dummy> std::string CLI::detail::type_name ( )
inline

Recursively generate the tuple type name.

◆ type_name() [3/3]

template<typename T , enable_if_t< classify_object< T >::value==object_category::vector_value, detail::enabler > = detail::dummy>
std::string CLI::detail::type_name ( )
inline

This one should not be used normally, since vector types print the internal type.

◆ valid_first_char()

template<typename T >
bool CLI::detail::valid_first_char ( c)

Verify the first character of an option.

◆ valid_later_char()

template<typename T >
bool CLI::detail::valid_later_char ( c)

Verify following characters of an option.

◆ valid_name_string()

bool CLI::detail::valid_name_string ( const std::string &  str)
inline

Verify an option name.

◆ value_string() [1/2]

template<typename T , enable_if_t< std::is_arithmetic< T >::value, detail::enabler > = detail::dummy>
std::string CLI::detail::value_string ( const T &  value)

get a string as a convertible value for arithmetic types

get a string as a convertible value for enumerations

◆ value_string() [2/2]

template<typename T , enable_if_t<!std::is_enum< T >::value &&!std::is_arithmetic< T >::value, detail::enabler > = detail::dummy>
auto CLI::detail::value_string ( const T &  value) -> decltype(to_string(value))

for other types just use the regular to_string function

Variable Documentation

◆ dummy

constexpr enabler CLI::detail::dummy = {}
constexpr

An instance to use in EnableIf.

◆ expected_max_vector_size

constexpr int CLI::detail::expected_max_vector_size {1 << 29}
constexpr

a constant defining an expected max vector size defined to be a big number that could be multiplied by 4 and not produce overflow for some expected uses