CLI11 2.4.1
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Typedefs | Enumerations | Functions | Variables
TypeTools.hpp File Reference
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <exception>
#include <limits>
#include <memory>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
#include "Encoding.hpp"
#include "StringTools.hpp"

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_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_complex< T >
 Check for complex. More...
 
struct  CLI::detail::is_mutable_container< T, _ >
 
struct  CLI::detail::is_mutable_container< T, conditional_t< false, void_t< typename T::value_type, decltype(std::declval< T >().end()), decltype(std::declval< T >().clear()), decltype(std::declval< T >().insert(std::declval< decltype(std::declval< T >().end())>(), std::declval< const typename T::value_type & >()))>, void > >
 
struct  CLI::detail::is_readable_container< T, _ >
 
struct  CLI::detail::is_readable_container< T, conditional_t< false, void_t< decltype(std::declval< T >().end()), decltype(std::declval< T >().begin())>, void > >
 
struct  CLI::detail::is_wrapper< T, _ >
 
struct  CLI::detail::is_wrapper< T, conditional_t< false, void_t< typename T::value_type >, void > >
 
class  CLI::detail::is_tuple_like< S >
 
struct  CLI::detail::wrapped_type< T, def, Enable >
 template to get the underlying value type if it exists or use a default More...
 
struct  CLI::detail::wrapped_type< T, def, typename std::enable_if< is_wrapper< T >::value >::type >
 Type size for regular object types that do not look like a tuple. More...
 
struct  CLI::detail::type_count_base< T, Enable >
 This will only trigger for actual void type. More...
 
struct  CLI::detail::type_count_base< T, typename std::enable_if<!is_tuple_like< T >::value &&!is_mutable_container< 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_base< T, typename std::enable_if< is_tuple_like< T >::value &&!is_mutable_container< T >::value >::type >
 the base tuple size More...
 
struct  CLI::detail::type_count_base< T, typename std::enable_if< is_mutable_container< T >::value >::type >
 Type count base for containers is the type_count_base of the individual element. More...
 
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_wrapper< T >::value &&!is_tuple_like< T >::value &&!is_complex< 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_complex< T >::value >::type >
 Type size for complex since it sometimes looks like a wrapper. More...
 
struct  CLI::detail::type_count< T, typename std::enable_if< is_mutable_container< T >::value >::type >
 Type size of types that are wrappers,except complex and tuples(which can also be wrappers sometimes) More...
 
struct  CLI::detail::type_count< T, typename std::enable_if< is_wrapper< T >::value &&!is_complex< T >::value &&!is_tuple_like< T >::value &&!is_mutable_container< T >::value >::type >
 Type size of types that are wrappers,except containers complex and tuples(which can also be wrappers sometimes) More...
 

Namespaces

namespace  CLI
 
namespace  CLI::detail
 

Macros

#define WIDE_STRING_CHECK   true
 
#define STRING_CHECK   !std::is_assignable<T &, std::string>::value && !std::is_constructible<T, std::string>::value
 

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

Enumerations

enum class  CLI::detail::enabler
 Simple empty scoped class. More...
 

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.
 
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)
 
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.
 
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)
 
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
 
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
 
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
 
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
 
template<typename T , std::size_t I>
constexpr std::enable_if< I==type_count_base< T >::value, int >::type CLI::detail::tuple_type_size ()
 0 if the index > tuple size
 
 CLI::detail::return (val==(input.c_str()+input.size()) &&static_cast< std::uint64_t >(output)==output_ll)
 
 CLI::detail::if (input.compare(0, 2, "0b")==0)
 
template<typename T , enable_if_t< std::is_signed< T >::value, detail::enabler > = detail::dummy>
bool CLI::detail::integral_conversion (const std::string &input, T &output) noexcept
 Convert to a signed integral.
 
std::int64_t CLI::detail::to_flag_value (std::string val) noexcept
 Convert a flag into an integer value typically binary flags sets errno to nonzero if conversion failed.
 
template<typename T , enable_if_t< classify_object< T >::value==object_category::integral_value||classify_object< T >::value==object_category::unsigned_integral, detail::enabler > = detail::dummy>
bool CLI::detail::lexical_cast (const std::string &input, T &output)
 Integer conversion.
 
template<typename AssignTo , typename ConvertTo , enable_if_t< std::is_same< AssignTo, ConvertTo >::value &&(classify_object< AssignTo >::value==object_category::string_assignable||classify_object< AssignTo >::value==object_category::string_constructible||classify_object< AssignTo >::value==object_category::wstring_assignable||classify_object< AssignTo >::value==object_category::wstring_constructible), detail::enabler > = detail::dummy>
bool CLI::detail::lexical_assign (const std::string &input, AssignTo &output)
 Assign a value through lexical cast operations.
 

Variables

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

Macro Definition Documentation

◆ STRING_CHECK

#define STRING_CHECK   !std::is_assignable<T &, std::string>::value && !std::is_constructible<T, std::string>::value

◆ WIDE_STRING_CHECK

#define WIDE_STRING_CHECK   true