Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
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  classify_object< T, typename std::enable_if<(type_count< T >::value >=2 &&!is_vector< T >::value)||(is_tuple_like< T >::value &&uncommon_type< T >::value &&!is_direct_constructible< T, double >::value &&!is_direct_constructible< T, int >::value)>::type >
 Tuple type. 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 class  enabler
 Simple empty scoped class. More...
 
enum class  object_category : int {
  integral_value = 2 , unsigned_integral = 4 , enumeration = 6 , boolean_value = 8 ,
  floating_point = 10 , number_constructible = 12 , double_constructible = 14 , integer_constructible = 16 ,
  vector_value = 30 , tuple_value = 35 , string_assignable = 50 , string_constructible = 60 ,
  other = 200
}
 
enum class  path_type { nonexistant , file , directory }
 CLI enumeration of different file types. More...
 
enum class  Classifier {
  NONE , POSITIONAL_MARK , SHORT , LONG ,
  WINDOWS , SUBCOMMAND , SUBCOMMAND_TERMINATOR
}
 

Functions

std::vector< std::string > split (const std::string &s, char delim)
 Split a string by a delim.
 
template<typename T >
std::string join (const T &v, std::string delim=",")
 Simple function to join a string.
 
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.
 
template<typename T >
std::string rjoin (const T &v, std::string delim=",")
 Join a string in reverse order.
 
std::string & ltrim (std::string &str)
 Trim whitespace from left of string.
 
std::string & ltrim (std::string &str, const std::string &filter)
 Trim anything from left of string.
 
std::string & rtrim (std::string &str)
 Trim whitespace from right of string.
 
std::string & rtrim (std::string &str, const std::string &filter)
 Trim anything from right of string.
 
std::string & trim (std::string &str)
 Trim whitespace from string.
 
std::string & trim (std::string &str, const std::string filter)
 Trim anything from string.
 
std::string trim_copy (const std::string &str)
 Make a copy of the string and then trim it.
 
std::string & remove_quotes (std::string &str)
 remove quotes at the front and back of a string either '"' or '\''
 
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)
 
std::ostream & format_help (std::ostream &out, std::string name, std::string description, std::size_t wid)
 Print a two part "help" string.
 
template<typename T >
bool valid_first_char (T c)
 Verify the first character of an option.
 
template<typename T >
bool valid_later_char (T c)
 Verify following characters of an option.
 
bool valid_name_string (const std::string &str)
 Verify an option name.
 
bool isalpha (const std::string &str)
 Verify that str consists of letters only.
 
std::string to_lower (std::string str)
 Return a lower case version of a string.
 
std::string remove_underscore (std::string str)
 remove underscores from a string
 
std::string find_and_replace (std::string str, std::string from, std::string to)
 Find and replace a substring with another substring.
 
bool has_default_flag_values (const std::string &flags)
 check if the flag definitions has possible false flags
 
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.
 
template<typename Callable >
std::string find_and_modify (std::string str, std::string trigger, Callable modify)
 
 trim (str)
 
 while (!str.empty())
 
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.
 
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)
 
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)
 
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
 
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
 
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
 
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
 
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.
 
std::size_t I std::enable_if< I==type_count< T >::value, std::string >::type tuple_name ()
 
 if (str.back()==',') str.pop_back()
 
std::size_t I inline typename bool ::type tuple_conversion (const std::vector< std::string > &, T &)
 
template<class T , class XC , enable_if_t< is_tuple_like< T >::value, detail::enabler > = detail::dummy>
bool lexical_conversion (const std::vector< std ::string > &strings, T &output)
 Conversion for tuples.
 
template<typename T , enable_if_t< std::is_integral< T >::value &&std::is_unsigned< T >::value, detail::enabler > = detail::dummy>
void sum_flag_vector (const std::vector< std::string > &flags, T &output)
 
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 !
 
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.
 
path_type check_path (const char *file) noexcept
 get the type of the path from a file name
 
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.
 
template<typename T >
std::string generate_map (const T &map, bool key_only=false)
 Generate a string representation of a map.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
std::pair< std::string, std::string > split_program_name (std::string commandline)
 
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.
 
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
 

Variables

constexpr int expected_max_vector_size {1 << 29}
 
auto find_ws
 
std::vector< std::string > output
 
bool embeddedQuote = false
 
char keyChar = ' '
 
constexpr enabler dummy = {}
 An instance to use in EnableIf.
 
return str
 
 XC
 
return retval
 

Enumeration Type Documentation

◆ Classifier

Enumerator
NONE 
POSITIONAL_MARK 
SHORT 
LONG 
WINDOWS 
SUBCOMMAND 
SUBCOMMAND_TERMINATOR 

Definition at line 4592 of file CLI11.hpp.

◆ enabler

Definition at line 853 of file CLI11.hpp.

853{};

◆ object_category

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 

Definition at line 1162 of file CLI11.hpp.

◆ path_type

Enumerator
nonexistant 
file 
directory 

Definition at line 2307 of file CLI11.hpp.

2307{ nonexistant, file, directory };

Function Documentation

◆ check_path()

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

Definition at line 2336 of file CLI11.hpp.

2336 {
2337#if defined(_MSC_VER)
2338 struct __stat64 buffer;
2339 if(_stat64(file, &buffer) == 0) {
2340 return ((buffer.st_mode & S_IFDIR) != 0) ? path_type::directory : path_type::file;
2341 }
2342#else
2343 struct stat buffer;
2344 if(stat(file, &buffer) == 0) {
2345 return ((buffer.st_mode & S_IFDIR) != 0) ? path_type::directory : path_type::file;
2346 }
2347#endif
2348 return path_type::nonexistant;
2349}
Here is the caller graph for this function:

◆ checked_multiply() [1/2]

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

Definition at line 2684 of file CLI11.hpp.

2684 {
2685 if(a == 0 || b == 0 || a == 1 || b == 1) {
2686 a *= b;
2687 return true;
2688 }
2689 if(a == (std::numeric_limits<T>::min)() || b == (std::numeric_limits<T>::min)()) {
2690 return false;
2691 }
2692 if(overflowCheck(a, b)) {
2693 return false;
2694 }
2695 a *= b;
2696 return true;
2697}
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checked_multiply() [2/2]

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

Definition at line 2701 of file CLI11.hpp.

2701 {
2702 T c = a * b;
2703 if(std::isinf(c) && !std::isinf(a) && !std::isinf(b)) {
2704 return false;
2705 }
2706 a = c;
2707 return true;
2708}
#define T(meth, val, expected)

◆ 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 && )

Definition at line 1107 of file CLI11.hpp.

1107 {
1108 return std::string{};
1109}

◆ 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)))

Definition at line 1098 of file CLI11.hpp.

1098 {
1099 return to_string(std::forward<T>(value));
1100}
#define value
Definition pkcs11.h:157
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkParentSegments()

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

Definition at line 7723 of file CLI11.hpp.

7723 {
7724
7725 std::string estring;
7726 auto parents = detail::generate_parents(currentSection, estring);
7727 if(!output.empty() && output.back().name == "--") {
7728 std::size_t msize = (parents.size() > 1U) ? parents.size() : 2;
7729 while(output.back().parents.size() >= msize) {
7730 output.push_back(output.back());
7731 output.back().parents.pop_back();
7732 }
7733
7734 if(parents.size() > 1) {
7735 std::size_t common = 0;
7736 std::size_t mpair = (std::min)(output.back().parents.size(), parents.size() - 1);
7737 for(std::size_t ii = 0; ii < mpair; ++ii) {
7738 if(output.back().parents[ii] != parents[ii]) {
7739 break;
7740 }
7741 ++common;
7742 }
7743 if(common == mpair) {
7744 output.pop_back();
7745 } else {
7746 while(output.back().parents.size() > common + 1) {
7747 output.push_back(output.back());
7748 output.back().parents.pop_back();
7749 }
7750 }
7751 for(std::size_t ii = common; ii < parents.size() - 1; ++ii) {
7752 output.emplace_back();
7753 output.back().parents.assign(parents.begin(), parents.begin() + static_cast<std::ptrdiff_t>(ii) + 1);
7754 output.back().name = "++";
7755 }
7756 }
7757 } else if(parents.size() > 1) {
7758 for(std::size_t ii = 0; ii < parents.size() - 1; ++ii) {
7759 output.emplace_back();
7760 output.back().parents.assign(parents.begin(), parents.begin() + static_cast<std::ptrdiff_t>(ii) + 1);
7761 output.back().name = "++";
7762 }
7763 }
7764
7765 // insert a section end which is just an empty items_buffer
7766 output.emplace_back();
7767 output.back().parents = std::move(parents);
7768 output.back().name = "++";
7769}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_arg_for_ini()

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

Definition at line 7631 of file CLI11.hpp.

7631 {
7632 if(arg.empty()) {
7633 return std::string(2, '"');
7634 }
7635 // some specifically supported strings
7636 if(arg == "true" || arg == "false" || arg == "nan" || arg == "inf") {
7637 return arg;
7638 }
7639 // floating point conversion can convert some hex codes, but don't try that here
7640 if(arg.compare(0, 2, "0x") != 0 && arg.compare(0, 2, "0X") != 0) {
7641 double val;
7642 if(detail::lexical_cast(arg, val)) {
7643 return arg;
7644 }
7645 }
7646 // just quote a single non numeric character
7647 if(arg.size() == 1) {
7648 return std::string("'") + arg + '\'';
7649 }
7650 // handle hex, binary or octal arguments
7651 if(arg.front() == '0') {
7652 if(arg[1] == 'x') {
7653 if(std::all_of(arg.begin() + 2, arg.end(), [](char x) {
7654 return (x >= '0' && x <= '9') || (x >= 'A' && x <= 'F') || (x >= 'a' && x <= 'f');
7655 })) {
7656 return arg;
7657 }
7658 } else if(arg[1] == 'o') {
7659 if(std::all_of(arg.begin() + 2, arg.end(), [](char x) { return (x >= '0' && x <= '7'); })) {
7660 return arg;
7661 }
7662 } else if(arg[1] == 'b') {
7663 if(std::all_of(arg.begin() + 2, arg.end(), [](char x) { return (x == '0' || x == '1'); })) {
7664 return arg;
7665 }
7666 }
7667 }
7668 if(arg.find_first_of('"') == std::string::npos) {
7669 return std::string("\"") + arg + '"';
7670 } else {
7671 return std::string("'") + arg + '\'';
7672 }
7673}
Here is the caller graph for this 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

Definition at line 412 of file CLI11.hpp.

412 {
413 std::size_t start_pos = 0;
414 while((start_pos = str.find(trigger, start_pos)) != std::string::npos) {
415 start_pos = modify(str, start_pos);
416 }
417 return str;
418}
return str
Definition CLI11.hpp:1359
Here is the caller graph for this function:

◆ find_and_replace()

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

Definition at line 350 of file CLI11.hpp.

350 {
351
352 std::size_t start_pos = 0;
353
354 while((start_pos = str.find(from, start_pos)) != std::string::npos) {
355 str.replace(start_pos, from.length(), to);
356 start_pos += to.length();
357 }
358
359 return str;
360}
Here is the caller graph for this function:

◆ 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

Definition at line 381 of file CLI11.hpp.

384 {
385 auto it = std::end(names);
386 if(ignore_case) {
387 if(ignore_underscore) {
388 name = detail::to_lower(detail::remove_underscore(name));
389 it = std::find_if(std::begin(names), std::end(names), [&name](std::string local_name) {
390 return detail::to_lower(detail::remove_underscore(local_name)) == name;
391 });
392 } else {
393 name = detail::to_lower(name);
394 it = std::find_if(std::begin(names), std::end(names), [&name](std::string local_name) {
395 return detail::to_lower(local_name) == name;
396 });
397 }
398
399 } else if(ignore_underscore) {
400 name = detail::remove_underscore(name);
401 it = std::find_if(std::begin(names), std::end(names), [&name](std::string local_name) {
402 return detail::remove_underscore(local_name) == name;
403 });
404 } else
405 it = std::find(std::begin(names), std::end(names), name);
406
407 return (it != std::end(names)) ? (it - std::begin(names)) : (-1);
408}
std::string name
Here is the call graph for this function:
Here is the caller graph for this function:

◆ format_help()

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

Definition at line 295 of file CLI11.hpp.

295 {
296 name = " " + name;
297 out << std::setw(static_cast<int>(wid)) << std::left << name;
298 if(!description.empty()) {
299 if(name.length() >= wid)
300 out << "\n" << std::setw(static_cast<int>(wid)) << "";
301 for(const char c : description) {
302 out.put(c);
303 if(c == '\n') {
304 out << std::setw(static_cast<int>(wid)) << "";
305 }
306 }
307 }
308 out << "\n";
309 return out;
310}
Here is the caller graph for this function:

◆ 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 )

Definition at line 1027 of file CLI11.hpp.

1027 {
1028 std::istringstream is;
1029 is.str(istring);
1030 is >> obj;
1031 return !is.fail() && !is.rdbuf()->in_avail();
1032}

◆ generate_map()

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

Definition at line 2597 of file CLI11.hpp.

2597 {
2598 using element_t = typename detail::element_type<T>::type;
2599 using iteration_type_t = typename detail::pair_adaptor<element_t>::value_type; // the type of the object pair
2600 std::string out(1, '{');
2601 out.append(detail::join(
2602 detail::smart_deref(map),
2603 [key_only](const iteration_type_t &v) {
2604 std::string res{detail::to_string(detail::pair_adaptor<element_t>::first(v))};
2605
2606 if(!key_only) {
2607 res.append("->");
2608 res += detail::to_string(detail::pair_adaptor<element_t>::second(v));
2609 }
2610 return res;
2611 },
2612 ","));
2613 out.push_back('}');
2614 return out;
2615}
Adaptor for set-like structure: This just wraps a normal container in a few utilities that do almost ...
Definition CLI11.hpp:929
typename T::value_type value_type
Definition CLI11.hpp:930
Here is the call graph for this function:
Here is the caller graph for this function:

◆ generate_parents()

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

Definition at line 7698 of file CLI11.hpp.

7698 {
7699 std::vector<std::string> parents;
7700 if(detail::to_lower(section) != "default") {
7701 if(section.find('.') != std::string::npos) {
7702 parents = detail::split(section, '.');
7703 } else {
7704 parents = {section};
7705 }
7706 }
7707 if(name.find('.') != std::string::npos) {
7708 std::vector<std::string> plist = detail::split(name, '.');
7709 name = plist.back();
7710 detail::remove_quotes(name);
7711 plist.pop_back();
7712 parents.insert(parents.end(), plist.begin(), plist.end());
7713 }
7714
7715 // clean up quotes on the parents
7716 for(auto &parent : parents) {
7717 detail::remove_quotes(parent);
7718 }
7719 return parents;
7720}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ generate_set()

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

Definition at line 2584 of file CLI11.hpp.

2584 {
2585 using element_t = typename detail::element_type<T>::type;
2586 using iteration_type_t = typename detail::pair_adaptor<element_t>::value_type; // the type of the object pair
2587 std::string out(1, '{');
2588 out.append(detail::join(
2589 detail::smart_deref(set),
2590 [](const iteration_type_t &v) { return detail::pair_adaptor<element_t>::first(v); },
2591 ","));
2592 out.push_back('}');
2593 return out;
2594}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_default_flag_values()

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

Definition at line 1891 of file CLI11.hpp.

1891 {
1892 std::vector<std::string> flags = split_names(str);
1893 flags.erase(std::remove_if(flags.begin(),
1894 flags.end(),
1895 [](const std::string &name) {
1896 return ((name.empty()) || (!(((name.find_first_of('{') != std::string::npos) &&
1897 (name.back() == '}')) ||
1898 (name[0] == '!'))));
1899 }),
1900 flags.end());
1901 std::vector<std::pair<std::string, std::string>> output;
1902 output.reserve(flags.size());
1903 for(auto &flag : flags) {
1904 auto def_start = flag.find_first_of('{');
1905 std::string defval = "false";
1906 if((def_start != std::string::npos) && (flag.back() == '}')) {
1907 defval = flag.substr(def_start + 1);
1908 defval.pop_back();
1909 flag.erase(def_start, std::string::npos);
1910 }
1911 flag.erase(0, flag.find_first_not_of("-!"));
1912 output.emplace_back(flag, defval);
1913 }
1914 return output;
1915}
std::vector< std::string > split_names(std::string current)
Definition CLI11.hpp:1879
pInfo flags
Here is the call graph for this function:

◆ 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

Definition at line 1919 of file CLI11.hpp.

1919 {
1920
1921 std::vector<std::string> short_names;
1922 std::vector<std::string> long_names;
1923 std::string pos_name;
1924
1925 for(std::string name : input) {
1926 if(name.length() == 0) {
1927 continue;
1928 }
1929 if(name.length() > 1 && name[0] == '-' && name[1] != '-') {
1930 if(name.length() == 2 && valid_first_char(name[1]))
1931 short_names.emplace_back(1, name[1]);
1932 else
1933 throw BadNameString::OneCharName(name);
1934 } else if(name.length() > 2 && name.substr(0, 2) == "--") {
1935 name = name.substr(2);
1936 if(valid_name_string(name))
1937 long_names.push_back(name);
1938 else
1939 throw BadNameString::BadLongName(name);
1940 } else if(name == "-" || name == "--") {
1941 throw BadNameString::DashesOnly(name);
1942 } else {
1943 if(pos_name.length() > 0)
1944 throw BadNameString::MultiPositionalNames(name);
1945 pos_name = name;
1946 }
1947 }
1948
1949 return std::tuple<std::vector<std::string>, std::vector<std::string>, std::string>(
1950 short_names, long_names, pos_name);
1951}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ has_default_flag_values()

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

Definition at line 363 of file CLI11.hpp.

363 {
364 return (flags.find_first_of("{!") != std::string::npos);
365}

◆ if()

CLI::detail::if ( str. back() = =',')

◆ ini_join()

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

Definition at line 7677 of file CLI11.hpp.

7677 {
7678 std::string joined;
7679 if(args.size() > 1 && arrayStart != '\0') {
7680 joined.push_back(arrayStart);
7681 }
7682 std::size_t start = 0;
7683 for(const auto &arg : args) {
7684 if(start++ > 0) {
7685 joined.push_back(sepChar);
7686 if(isspace(sepChar) == 0) {
7687 joined.push_back(' ');
7688 }
7689 }
7690 joined.append(convert_arg_for_ini(arg));
7691 }
7692 if(args.size() > 1 && arrayEnd != '\0') {
7693 joined.push_back(arrayEnd);
7694 }
7695 return joined;
7696}
std::string convert_arg_for_ini(const std::string &arg)
Definition CLI11.hpp:7631
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isalpha()

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

Definition at line 331 of file CLI11.hpp.

331 {
332 return std::all_of(str.begin(), str.end(), [](char c) { return std::isalpha(c, std::locale()); });
333}

◆ 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 = "," )

Definition at line 212 of file CLI11.hpp.

212 {
213 std::ostringstream s;
214 auto beg = std::begin(v);
215 auto end = std::end(v);
216 if(beg != end)
217 s << func(*beg++);
218 while(beg != end) {
219 s << delim << func(*beg++);
220 }
221 return s.str();
222}
char * s

◆ join() [2/2]

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

Definition at line 196 of file CLI11.hpp.

196 {
197 std::ostringstream s;
198 auto beg = std::begin(v);
199 auto end = std::end(v);
200 if(beg != end)
201 s << *beg++;
202 while(beg != end) {
203 s << delim << *beg++;
204 }
205 return s.str();
206}
Here is the caller graph for this function:

◆ lexical_conversion()

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

Lexical conversion of a vector types with type_size >2.

Definition at line 1759 of file CLI11.hpp.

1759 {
1760 static_assert(
1762 "if the conversion type is defined as a tuple it must be the same size as the type you are converting to");
1763 return tuple_conversion<T, XC, 0>(strings, output);
1764}
This will only trigger for actual void type.
Definition CLI11.hpp:1128
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ltrim() [1/2]

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

Definition at line 238 of file CLI11.hpp.

238 {
239 auto it = std::find_if(str.begin(), str.end(), [](char ch) { return !std::isspace<char>(ch, std::locale()); });
240 str.erase(str.begin(), it);
241 return str;
242}
Here is the caller graph for this function:

◆ ltrim() [2/2]

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

Definition at line 245 of file CLI11.hpp.

245 {
246 auto it = std::find_if(str.begin(), str.end(), [&filter](char ch) { return filter.find(ch) == std::string::npos; });
247 str.erase(str.begin(), it);
248 return str;
249}

◆ 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

Definition at line 2670 of file CLI11.hpp.

2670 {
2671 if((a > 0) == (b > 0)) {
2672 return ((std::numeric_limits<T>::max)() / (std::abs)(a) < (std::abs)(b));
2673 } else {
2674 return ((std::numeric_limits<T>::min)() / (std::abs)(a) > -(std::abs)(b));
2675 }
2676}
Here is the caller graph for this function:

◆ 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

Definition at line 2679 of file CLI11.hpp.

2679 {
2680 return ((std::numeric_limits<T>::max)() / a < b);
2681}

◆ remove_default_flag_values()

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

Definition at line 367 of file CLI11.hpp.

367 {
368 auto loc = flags.find_first_of('{');
369 while(loc != std::string::npos) {
370 auto finish = flags.find_first_of("},", loc + 1);
371 if((finish != std::string::npos) && (flags[finish] == '}')) {
372 flags.erase(flags.begin() + static_cast<std::ptrdiff_t>(loc),
373 flags.begin() + static_cast<std::ptrdiff_t>(finish) + 1);
374 }
375 loc = flags.find_first_of('{', loc + 1);
376 }
377 flags.erase(std::remove(flags.begin(), flags.end(), '!'), flags.end());
378}

◆ remove_quotes()

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

Definition at line 279 of file CLI11.hpp.

279 {
280 if(str.length() > 1 && (str.front() == '"' || str.front() == '\'')) {
281 if(str.front() == str.back()) {
282 str.pop_back();
283 str.erase(str.begin(), str.begin() + 1);
284 }
285 }
286 return str;
287}
Here is the caller graph for this function:

◆ remove_underscore()

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

Definition at line 344 of file CLI11.hpp.

344 {
345 str.erase(std::remove(std::begin(str), std::end(str), '_'), std::end(str));
346 return str;
347}
Here is the caller graph for this function:

◆ rjoin()

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

Definition at line 225 of file CLI11.hpp.

225 {
226 std::ostringstream s;
227 for(std::size_t start = 0; start < v.size(); start++) {
228 if(start > 0)
229 s << delim;
230 s << v[v.size() - start - 1];
231 }
232 return s.str();
233}

◆ rtrim() [1/2]

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

Definition at line 252 of file CLI11.hpp.

252 {
253 auto it = std::find_if(str.rbegin(), str.rend(), [](char ch) { return !std::isspace<char>(ch, std::locale()); });
254 str.erase(it.base(), str.end());
255 return str;
256}
Here is the caller graph for this function:

◆ rtrim() [2/2]

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

Definition at line 259 of file CLI11.hpp.

259 {
260 auto it =
261 std::find_if(str.rbegin(), str.rend(), [&filter](char ch) { return filter.find(ch) == std::string::npos; });
262 str.erase(it.base(), str.end());
263 return str;
264}

◆ 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 that uses the built in find function.

Definition at line 2628 of file CLI11.hpp.

2628 {
2629 using element_t = typename detail::element_type<T>::type;
2630 auto &setref = detail::smart_deref(set);
2631 auto it = std::find_if(std::begin(setref), std::end(setref), [&val](decltype(*std::begin(setref)) v) {
2632 return (detail::pair_adaptor<element_t>::first(v) == val);
2633 });
2634 return {(it != std::end(setref)), it};
2635}
Here is the call graph for this function:
Here is the caller graph for this 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)))>

Definition at line 2647 of file CLI11.hpp.

2648 {
2649 using element_t = typename detail::element_type<T>::type;
2650 // do the potentially faster first search
2651 auto res = search(set, val);
2652 if((res.first) || (!(filter_function))) {
2653 return res;
2654 }
2655 // if we haven't found it do the longer linear search with all the element translations
2656 auto &setref = detail::smart_deref(set);
2657 auto it = std::find_if(std::begin(setref), std::end(setref), [&](decltype(*std::begin(setref)) v) {
2659 a = filter_function(a);
2660 return (a == val);
2661 });
2662 return {(it != std::end(setref)), it};
2663}
auto search(const T &set, const V &val) -> std::pair< bool, decltype(std::begin(detail::smart_deref(set)))>
A search function.
Definition CLI11.hpp:2628
Definition test_zm.cpp:19
Here is the call graph for this 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)

Definition at line 2580 of file CLI11.hpp.

2580 {
2581 return value;
2582}

◆ 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 ( T value) -> decltype(*value)

Definition at line 2573 of file CLI11.hpp.

2573 {
2574 return *value;
2575}
Here is the caller graph for this function:

◆ split()

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

Definition at line 179 of file CLI11.hpp.

179 {
180 std::vector<std::string> elems;
181 // Check to see if empty string, give consistent result
182 if(s.empty())
183 elems.emplace_back();
184 else {
185 std::stringstream ss;
186 ss.str(s);
187 std::string item;
188 while(std::getline(ss, item, delim)) {
189 elems.push_back(item);
190 }
191 }
192 return elems;
193}
Here is the caller graph for this function:

◆ split_long()

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

Definition at line 1847 of file CLI11.hpp.

1847 {
1848 if(current.size() > 2 && current.substr(0, 2) == "--" && valid_first_char(current[2])) {
1849 auto loc = current.find_first_of('=');
1850 if(loc != std::string::npos) {
1851 name = current.substr(2, loc - 2);
1852 value = current.substr(loc + 1);
1853 } else {
1854 name = current.substr(2);
1855 value = "";
1856 }
1857 return true;
1858 }
1859 return false;
1860}
bool valid_first_char(T c)
Verify the first character of an option.
Definition CLI11.hpp:313
Here is the call graph for this function:
Here is the caller graph for this function:

◆ split_names()

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

Definition at line 1879 of file CLI11.hpp.

1879 {
1880 std::vector<std::string> output;
1881 std::size_t val;
1882 while((val = current.find(",")) != std::string::npos) {
1883 output.push_back(trim_copy(current.substr(0, val)));
1884 current = current.substr(val + 1);
1885 }
1886 output.push_back(trim_copy(current));
1887 return output;
1888}
std::string trim_copy(const std::string &str)
Make a copy of the string and then trim it.
Definition CLI11.hpp:273
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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.

Definition at line 3128 of file CLI11.hpp.

3128 {
3129 // try to determine the programName
3130 std::pair<std::string, std::string> vals;
3131 trim(commandline);
3132 auto esp = commandline.find_first_of(' ', 1);
3133 while(detail::check_path(commandline.substr(0, esp).c_str()) != path_type::file) {
3134 esp = commandline.find_first_of(' ', esp + 1);
3135 if(esp == std::string::npos) {
3136 // if we have reached the end and haven't found a valid file just assume the first argument is the
3137 // program name
3138 esp = commandline.find_first_of(' ', 1);
3139 break;
3140 }
3141 }
3142 vals.first = commandline.substr(0, esp);
3143 rtrim(vals.first);
3144 // strip the program name
3145 vals.second = (esp != std::string::npos) ? commandline.substr(esp + 1) : std::string{};
3146 ltrim(vals.second);
3147 return vals;
3148}
std::string & ltrim(std::string &str)
Trim whitespace from left of string.
Definition CLI11.hpp:238
Here is the call graph for this function:
Here is the caller graph for this function:

◆ split_short()

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

Definition at line 1837 of file CLI11.hpp.

1837 {
1838 if(current.size() > 1 && current[0] == '-' && valid_first_char(current[1])) {
1839 name = current.substr(1, 1);
1840 rest = current.substr(2);
1841 return true;
1842 }
1843 return false;
1844}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ split_windows_style()

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

Definition at line 1863 of file CLI11.hpp.

1863 {
1864 if(current.size() > 1 && current[0] == '/' && valid_first_char(current[1])) {
1865 auto loc = current.find_first_of(':');
1866 if(loc != std::string::npos) {
1867 name = current.substr(1, loc - 1);
1868 value = current.substr(loc + 1);
1869 } else {
1870 name = current.substr(1);
1871 value = "";
1872 }
1873 return true;
1874 }
1875 return false;
1876}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sum_flag_vector()

template<typename T , enable_if_t< std::is_integral< T >::value &&std::is_unsigned< T >::value, detail::enabler > = detail::dummy>
void CLI::detail::sum_flag_vector ( const std::vector< std::string > & flags,
T & output )

Sum a vector of flag representations The flag vector produces a series of strings in a vector, simple true is represented by a "1", simple false is by "-1" an if numbers are passed by some fashion they are captured as well so the function just checks for the most common true and false strings then uses stoll to convert the rest for summing

Definition at line 1805 of file CLI11.hpp.

1805 {
1806 int64_t count{0};
1807 for(auto &flag : flags) {
1808 count += detail::to_flag_value(flag);
1809 }
1810 output = (count > 0) ? static_cast<T>(count) : T{0};
1811}
int * count
signed __int64 int64_t
Definition stdint.h:135
Here is the caller graph for this function:

◆ to_lower()

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

Definition at line 336 of file CLI11.hpp.

336 {
337 std::transform(std::begin(str), std::end(str), std::begin(str), [](const std::string::value_type &x) {
338 return std::tolower(x, std::locale());
339 });
340 return str;
341}
Here is the caller graph for this function:

◆ 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 a vector to a string

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

Definition at line 1061 of file CLI11.hpp.

1061 {
1062 std::stringstream stream;
1063 stream << value;
1064 return stream.str();
1065}

◆ 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))

Definition at line 1053 of file CLI11.hpp.

1053 {
1054 return std::forward<T>(value);
1055}
Here is the caller graph for this function:

◆ trim() [1/3]

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

Definition at line 267 of file CLI11.hpp.

267{ return ltrim(rtrim(str)); }
std::string & rtrim(std::string &str)
Trim whitespace from right of string.
Definition CLI11.hpp:252
Here is the call graph for this function:
Here is the caller graph for this function:

◆ trim() [2/3]

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

Definition at line 270 of file CLI11.hpp.

270{ return ltrim(rtrim(str, filter), filter); }
Here is the call graph for this function:

◆ trim() [3/3]

CLI::detail::trim ( str )

◆ trim_copy() [1/2]

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

Definition at line 273 of file CLI11.hpp.

273 {
274 std::string s = str;
275 return trim(s);
276}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ trim_copy() [2/2]

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

Definition at line 290 of file CLI11.hpp.

290 {
291 std::string s = str;
292 return trim(s, filter);
293}
Here is the call graph for this function:

◆ tuple_conversion()

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

Definition at line 1738 of file CLI11.hpp.

1739 {
1740 return true;
1741}
Here is the caller graph for this function:

◆ tuple_name()

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

Definition at line 1349 of file CLI11.hpp.

1349 {
1350 return std::string{};
1351}

◆ type_name()

const char * CLI::detail::type_name ( )
constexpr

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

Definition at line 1299 of file CLI11.hpp.

1299 {
1300 return "INT";
1301}
Here is the caller graph for this function:

◆ valid_first_char()

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

Definition at line 313 of file CLI11.hpp.

313 {
314 return std::isalnum(c, std::locale()) || c == '_' || c == '?' || c == '@';
315}
Here is the caller graph for this function:

◆ valid_later_char()

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

Definition at line 318 of file CLI11.hpp.

318{ return valid_first_char(c) || c == '.' || c == '-'; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ valid_name_string()

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

Definition at line 321 of file CLI11.hpp.

321 {
322 if(str.empty() || !valid_first_char(str[0]))
323 return false;
324 for(auto c : str.substr(1))
325 if(!valid_later_char(c))
326 return false;
327 return true;
328}
bool valid_later_char(T c)
Verify following characters of an option.
Definition CLI11.hpp:318
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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 enumerations

Definition at line 1112 of file CLI11.hpp.

1112 {
1113 return std::to_string(value);
1114}
Here is the caller graph for this function:

◆ 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))

Definition at line 1123 of file CLI11.hpp.

1123 {
1124 return to_string(value);
1125}
Here is the call graph for this function:

◆ while()

CLI::detail::while ( !str. empty())

Definition at line 433 of file CLI11.hpp.

433 {
434 if(delims.find_first_of(str[0]) != std::string::npos) {
435 keyChar = str[0];
436 auto end = str.find_first_of(keyChar, 1);
437 while((end != std::string::npos) && (str[end - 1] == '\\')) { // deal with escaped quotes
438 end = str.find_first_of(keyChar, end + 1);
439 embeddedQuote = true;
440 }
441 if(end != std::string::npos) {
442 output.push_back(str.substr(1, end - 1));
443 str = str.substr(end + 1);
444 } else {
445 output.push_back(str.substr(1));
446 str = "";
447 }
448 } else {
449 auto it = std::find_if(std::begin(str), std::end(str), find_ws);
450 if(it != std::end(str)) {
451 std::string value = std::string(str.begin(), it);
452 output.push_back(value);
453 str = std::string(it + 1, str.end());
454 } else {
455 output.push_back(str);
456 str = "";
457 }
458 }
459 // transform any embedded quotes into the regular character
460 if(embeddedQuote) {
461 output.back() = find_and_replace(output.back(), std::string("\\") + keyChar, std::string(1, keyChar));
462 embeddedQuote = false;
463 }
464 trim(str);
465 }
std::string find_and_replace(std::string str, std::string from, std::string to)
Find and replace a substring with another substring.
Definition CLI11.hpp:350
bool embeddedQuote
Definition CLI11.hpp:431
char keyChar
Definition CLI11.hpp:432
fc::string trim(const fc::string &)
Definition string.cpp:152
Here is the call graph for this function:

Variable Documentation

◆ dummy

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

Definition at line 856 of file CLI11.hpp.

856{};

◆ embeddedQuote

bool CLI::detail::embeddedQuote = false

Definition at line 431 of file CLI11.hpp.

◆ expected_max_vector_size

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

Definition at line 176 of file CLI11.hpp.

176{1 << 29};

◆ find_ws

auto CLI::detail::find_ws
Initial value:
= [delimiter](char ch) {
return (delimiter == '\0') ? (std::isspace<char>(ch, std::locale()) != 0) : (ch == delimiter);
}

Split a string '"one two" "three"' into 'one two', 'three' Quote characters can be ‘ ’ or " inline std::vector<std::string> split_up(std::string str, char delimiter = '\0') { @iverbatim const std::string delims("\'"`");

Definition at line 425 of file CLI11.hpp.

425 {
426 return (delimiter == '\0') ? (std::isspace<char>(ch, std::locale()) != 0) : (ch == delimiter);
427 };

◆ keyChar

char CLI::detail::keyChar = ' '

Definition at line 432 of file CLI11.hpp.

◆ output

return CLI::detail::output

Definition at line 430 of file CLI11.hpp.

◆ retval

return CLI::detail::retval

Definition at line 1754 of file CLI11.hpp.

◆ str

return CLI::detail::str

Definition at line 1359 of file CLI11.hpp.

◆ XC

CLI::detail::XC

Definition at line 1579 of file CLI11.hpp.