Ookii.CommandLine for C++  2.0.0
value_description.h
Go to the documentation of this file.
1 #ifndef OOKII_VALUE_DESCRIPTION_H_
4 #define OOKII_VALUE_DESCRIPTION_H_
5 
6 #pragma once
7 
8 #include "type_info.h"
9 
10 namespace ookii
11 {
28  template<typename T, typename CharType = char, typename Traits = std::char_traits<char>, typename Alloc = std::allocator<char>>
30  {
32  static std::basic_string<CharType, Traits, Alloc> get()
33  {
34  return get_short_type_name<T, CharType, Traits, Alloc>();
35  }
36  };
37 
49  template<typename CharType, typename Traits, typename Alloc, typename CharType2, typename Traits2, typename Alloc2>
50  struct value_description<std::basic_string<CharType2, Traits2, Alloc2>, CharType, Traits, Alloc>
51  {
53  static std::basic_string<CharType, Traits, Alloc> get()
54  {
55  constexpr auto result = literal_cast<CharType>("string");
56  return {result.data()};
57  }
58  };
59 
68  template<typename T, typename CharType, typename Traits, typename Alloc>
69  struct value_description<std::optional<T>, CharType, Traits, Alloc>
70  {
72  static std::basic_string<CharType, Traits, Alloc> get()
73  {
75  }
76  };
77 
78 }
79 
80 #endif // !defined(OOKII_VALUE_DESCRIPTION_H_)
Namespace containing the core Ookii.CommandLine.Cpp types.
Definition: command_line_argument.h:16
static std::basic_string< CharType, Traits, Alloc > get()
Gets the value description for the type.
Definition: value_description.h:53
static std::basic_string< CharType, Traits, Alloc > get()
Gets the value description for the type.
Definition: value_description.h:72
Template used to specify the default value description for a type.
Definition: value_description.h:30
static std::basic_string< CharType, Traits, Alloc > get()
Gets the value description for the type.
Definition: value_description.h:32
Provides helpers to obtain the name of a type.