qxLib
string_setup.h
Go to the documentation of this file.
1 /**
2 
3  @file string_setup.h
4  @author Khrapov
5  @date 10.06.2023
6  @copyright � Nick Khrapov, 2023. All right reserved.
7 
8 **/
9 #pragma once
10 
11 #include <qx/macros/config.h>
12 #include <qx/meta/tuple_utils.h>
13 
14 #define QX_ALL_CHAR_TYPES char, wchar_t
15 
16 #ifdef QX_CONF_USE_CHAR
17  #define QX_CONF_USE_WCHAR !QX_CONF_USE_CHAR
18 #elif defined(QX_CONF_USE_WCHAR)
19  #define QX_CONF_USE_CHAR !QX_CONF_USE_WCHAR
20 #elif !defined(QX_CONF_USE_CHAR) && !defined(QX_CONF_USE_WCHAR)
21  #define QX_CONF_USE_CHAR 0
22  #define QX_CONF_USE_WCHAR 1
23 #endif
24 
25 namespace qx::details
26 {
27 
28 using all_char_types = std::tuple<QX_ALL_CHAR_TYPES>;
29 
30 }
31 
32 
33 #if QX_CONF_USE_CHAR
34 
35  #define QX_CHAR_TYPE char
36  #define _QXT(quote) quote
37 
38 #elif QX_CONF_USE_WCHAR
39 
40  #define QX_CHAR_TYPE wchar_t
41  #define _QXT(quote) L##quote
42 
43  #if !defined(QX_CONF_UNICODE_MACRO)
44  #define QX_CONF_UNICODE_MACRO 1
45  #endif
46 
47  #if QX_CONF_UNICODE_MACRO && QX_WIN
48  #define UNICODE
49  #endif
50 
51 #endif
52 
53 #define QXT(quote) _QXT(quote)
54 
55 namespace qx
56 {
57 
58 using char_type = QX_CHAR_TYPE;
59 using forbidden_char_types = tuple_utils::remove_t<details::all_char_types, std::tuple<char_type>>;
60 
61 } // namespace qx
Contains utils for working with std::tuple.