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 (c) 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 public:
41  /**
42  @brief Get type signature (full name with template parameters)
43  @retval - type signature
44  **/
45  static constexpr string_view_type get_signature();
46 
47  /**
48  @brief Get type name (short name without template parameters)
49  @retval - type name
50  **/
51  static constexpr string_view_type get_name();
52 
53  /**
54  @brief Get type template parameters
55  @retval - template parameters
56  **/
57  static constexpr auto get_template_parameters();
58 
59 private:
60  static constexpr string_view_type create_full_signature();
61  static constexpr string_view_type create_signature();
62  static constexpr size_t get_num_template_parameters();
63 
64 private:
65  static constexpr string_view_type k_svLambdaMarker = QX_STR_PREFIX(char_t, "lambda");
66 };
67 
68 } // namespace qx
69 
70 #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:120