CLI11  1.9.1
Classes | Namespaces | Typedefs | Enumerations | Functions | Variables
TypeTools.hpp File Reference
#include "StringTools.hpp"
#include <cstdint>
#include <exception>
#include <memory>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
Include dependency graph for TypeTools.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  CLI::make_void< Ts >
 A copy of std::void_t from C++17 (helper for C++11 and C++14) More...
 
struct  CLI::is_vector< T >
 Check to see if something is a vector (fail check by default) More...
 
struct  CLI::is_vector< std::vector< T, A > >
 Check to see if something is a vector (true if actually a vector) More...
 
struct  CLI::is_vector< const std::vector< T, A > >
 Check to see if something is a vector (true if actually a const vector) More...
 
struct  CLI::is_bool< T >
 Check to see if something is bool (fail check by default) More...
 
struct  CLI::is_bool< bool >
 Check to see if something is bool (true if actually a bool) More...
 
struct  CLI::is_shared_ptr< T >
 Check to see if something is a shared pointer. More...
 
struct  CLI::is_shared_ptr< std::shared_ptr< T > >
 Check to see if something is a shared pointer (True if really a shared pointer) More...
 
struct  CLI::is_shared_ptr< const std::shared_ptr< T > >
 Check to see if something is a shared pointer (True if really a shared pointer) More...
 
struct  CLI::is_copyable_ptr< T >
 Check to see if something is copyable pointer. More...
 
struct  CLI::IsMemberType< T >
 This can be specialized to override the type deduction for IsMember. More...
 
struct  CLI::IsMemberType< const char * >
 The main custom type needed here is const char * should be a string. More...
 
struct  CLI::detail::element_type< T, Enable >
 not a pointer More...
 
struct  CLI::detail::element_type< T, typename std::enable_if< is_copyable_ptr< T >::value >::type >
 
struct  CLI::detail::element_value_type< T >
 
struct  CLI::detail::pair_adaptor< T, _ >
 Adaptor for set-like structure: This just wraps a normal container in a few utilities that do almost nothing. More...
 
struct  CLI::detail::pair_adaptor< T, conditional_t< false, void_t< typename T::value_type::first_type, typename T::value_type::second_type >, void > >
 
class  CLI::detail::is_direct_constructible< T, C >
 
class  CLI::detail::is_ostreamable< T, S >
 
class  CLI::detail::is_istreamable< T, S >
 Check for input streamability. More...
 
class  CLI::detail::is_tuple_like< S >
 
struct  CLI::detail::type_count< T, Enable >
 This will only trigger for actual void type. More...
 
struct  CLI::detail::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  CLI::detail::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  CLI::detail::type_count< T, typename std::enable_if< is_vector< T >::value >::type >
 Type size of types that look like a vector. More...
 
struct  CLI::detail::expected_count< T, Enable >
 This will only trigger for actual void type. More...
 
struct  CLI::detail::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  CLI::detail::expected_count< T, typename std::enable_if< is_vector< T >::value >::type >
 number of expected items in a vector More...
 
struct  CLI::detail::classify_object< T, Enable >
 some type that is not otherwise recognized More...
 
struct  CLI::detail::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  CLI::detail::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  CLI::detail::classify_object< T, typename std::enable_if< is_bool< T >::value >::type >
 Boolean values. More...
 
struct  CLI::detail::classify_object< T, typename std::enable_if< std::is_floating_point< T >::value >::type >
 Floats. More...
 
struct  CLI::detail::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  CLI::detail::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  CLI::detail::classify_object< T, typename std::enable_if< std::is_enum< T >::value >::type >
 Enumerations. More...
 
struct  CLI::detail::uncommon_type< T >
 
struct  CLI::detail::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  CLI::detail::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  CLI::detail::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  CLI::detail::classify_object< T, Enable >::type >
 Tuple type. More...
 
struct  CLI::detail::classify_object< T, typename std::enable_if< is_vector< T >::value >::type >
 Vector type. More...
 

Namespaces

 CLI
 
 CLI::detail
 

Typedefs

template<bool B, class T = void>
using CLI::enable_if_t = typename std::enable_if< B, T >::type
 
template<typename... Ts>
using CLI::void_t = typename make_void< Ts... >::type
 A copy of std::void_t from C++17 - same reasoning as enable_if_t, it does not hurt to redefine. More...
 
template<bool B, class T , class F >
using CLI::conditional_t = typename std::conditional< B, T, F >::type
 A copy of std::conditional_t from C++14 - same reasoning as enable_if_t, it does not hurt to redefine. More...
 

Enumerations

enum  CLI::detail::enabler
 Simple empty scoped class. More...
 
enum  CLI::detail::object_category : int {
  CLI::detail::object_category::integral_value = 2, CLI::detail::object_category::unsigned_integral = 4, CLI::detail::object_category::enumeration = 6, CLI::detail::object_category::boolean_value = 8,
  CLI::detail::object_category::floating_point = 10, CLI::detail::object_category::number_constructible = 12, CLI::detail::object_category::double_constructible = 14, CLI::detail::object_category::integer_constructible = 16,
  CLI::detail::object_category::vector_value = 30, CLI::detail::object_category::tuple_value = 35, CLI::detail::object_category::string_assignable = 50, CLI::detail::object_category::string_constructible = 60,
  CLI::detail::object_category::other = 200
}
 

Functions

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. More...
 
template<typename T , enable_if_t< std::is_convertible< T, std::string >::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) More...
 
template<typename T , enable_if_t< std::is_constructible< std::string, T >::value &&!std::is_convertible< T, std::string >::value, detail::enabler > = detail::dummy>
std::string CLI::detail::to_string (const T &value)
 Construct a string from the object. More...
 
template<typename T , enable_if_t<!std::is_convertible< std::string, T >::value &&!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) More...
 
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 More...
 
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 More...
 
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 More...
 
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 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 * CLI::detail::type_name ()
 Print name for enumeration types. More...
 
std::size_t I std::enable_if< I==type_count< T >::value, std::string >::type CLI::detail::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 CLI::detail::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 CLI::detail::type_name ()
 This one should not be used normally, since vector types print the internal type. More...
 
std::int64_t CLI::detail::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 CLI::detail::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 CLI::detail::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 CLI::detail::lexical_conversion (const std::vector< std ::string > &strings, T &output)
 Lexical conversion if there is only one element. More...
 
bool ::type CLI::detail::tuple_conversion (const std::vector< std::string > &, T &)
 

Variables

constexpr enabler CLI::detail::dummy = {}
 An instance to use in EnableIf. More...