qxLib
type_strings.h
Go to the documentation of this file.
1 /**
2 
3  @file type_strings.h
4  @author Khrapov
5  @date 24.09.2022
6  @copyright © Nick Khrapov, 2022. All right reserved.
7 
8 **/
9 #pragma once
10 
14 #include <qx/macros/config.h>
15 
16 #include <array>
17 #include <span>
18 
19 namespace qx
20 {
21 
22 /**
23 
24  @class type_strings
25  @brief The class allows you to get strings with information about the type,
26  including its full name, name without template parameters
27  and a list of template parameters separately
28  @details Strings are COMPILER IMPLEMENTATION DEPENDENT but can be used for a human readable output
29  @tparam T - type to get information for
30  @tparam char_t - char type to use
31  @author Khrapov
32  @date 24.09.2022
33 
34 **/
35 template<class T, class char_t = char_type>
37 {
38  using string_view_type = basic_string_view<char_t>;
39 
40 private:
41  static constexpr string_view_type lambdaMarker = QX_STR_PREFIX(char_t, "lambda");
42  static constexpr string_view_type create_full_signature();
43  static constexpr string_view_type create_signature();
44  static constexpr size_t get_num_template_parameters();
45 
46 public:
47  /**
48  @brief Get type signature (full name with template parameters)
49  @retval - type signature
50  **/
51  static constexpr string_view_type get_signature();
52 
53  /**
54  @brief Get type name (short name without template parameters)
55  @retval - type name
56  **/
57  static constexpr string_view_type get_name();
58 
59  /**
60  @brief Get type template parameters
61  @retval - template parameters
62  **/
63  static constexpr auto get_template_parameters();
64 };
65 
66 } // namespace qx
67 
68 #include <qx/meta/type_strings.inl>
The class allows you to get strings with information about the type, including its full name,...
Definition: type_strings.h:37
static constexpr auto get_template_parameters()
Get type template parameters.
static constexpr string_view_type get_name()
Get type name (short name without template parameters)
static constexpr string_view_type get_signature()
Get type signature (full name with template parameters)
#define QX_STR_PREFIX(value_t, str)
Chose witch of prefixes add to string : L or none.
Definition: string_utils.h:249