Loading...
Searching...
No Matches
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...
class | CLI::adl_detail::is_lexical_castable< T, S >
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::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::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< 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
namespace | CLI::adl_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 : std::uint8_t
| 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<!is_istreamable< T >::value, detail::enabler > = detail::dummy>
bool | CLI::detail::from_stream (const std::string &, T &)
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 (T &&value)
| Construct a string from the object.
template<typename T, enable_if_t<!std::is_convertible< T, std::string >::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 T, enable_if_t<!std::is_convertible< T, std::string >::value &&!std::is_constructible< std::string, T >::value &&!is_ostreamable< T >::value &&is_tuple_like< T >::value &&type_count_base< T >::value==1, detail::enabler > = detail::dummy>
std::string | CLI::detail::to_string (T &&value)
| Print tuple value string for tuples of size ==1.
template<typename T, enable_if_t<!std::is_convertible< T, std::string >::value &&!std::is_constructible< std::string, T >::value &&!is_ostreamable< T >::value &&is_tuple_like< T >::value &&type_count_base< T >::value > = 2, detail::enabler>
std::string | CLI::detail::to_string (T &&value)
| Print tuple value string for tuples of size > 1.
template<typename T, enable_if_t<!std::is_convertible< T, std::string >::value &&!std::is_constructible< std::string, T >::value &&!is_ostreamable< T >::value &&!is_readable_container< typename std::remove_const< T >::type >::value &&!is_tuple_like< T >::value, detail::enabler > = detail::dummy>
std::string | CLI::detail::to_string (T &&)
| If conversion is not supported, return an empty string (streaming is not supported for that type).
template<typename T, enable_if_t<!std::is_convertible< T, std::string >::value &&!std::is_constructible< std::string, T >::value &&!is_ostreamable< T >::value &&is_readable_container< T >::value &&!is_tuple_like< T >::value, detail::enabler > = detail::dummy>
std::string | CLI::detail::to_string (T &&variable)
| convert a readable container to a string
template<typename T, std::size_t I>
std::enable_if< I==type_count_base< T >::value, std::string >::type | CLI::detail::tuple_value_string (T &&)
| Convert a tuple like object to a string.
template<typename T, std::size_t I>
std::enable_if<(I< type_count_base< T >::value), std::string >::type | CLI::detail::tuple_value_string (T &&value)
| Recursively generate the tuple value string.
template<typename T, enable_if_t<!std::is_convertible< T, std::string >::value &&!std::is_constructible< std::string, T >::value &&!is_ostreamable< T >::value &&is_tuple_like< T >::value &&type_count_base< T >::value > = 2>
std::string | CLI::detail::to_string (T &&value)
| Print tuple value string for tuples of size > 1.
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, detail::enabler > = detail::dummy>
std::string | CLI::detail::value_string (const T &value)
| get a string as a convertible value for enumerations
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

## Variables

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

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