ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
chartypes.inl
Go to the documentation of this file.
1//==================================================================================================
2/// \file
3/// This header-file is part of module \alib_characters of the \aliblong.
4///
5/// \emoji :copyright: 2013-2025 A-Worx GmbH, Germany.
6/// Published under \ref mainpage_license "Boost Software License".
7//==================================================================================================
8ALIB_EXPORT namespace alib { namespace characters {
9
10// #################################################################################################
11// Narrow type: nchar
12// #################################################################################################
13
14/// This type represents a narrow character in \alib. This is an alias for built-in C++
15/// type \c char.
16///
17/// \see
18/// For details, see chapter \ref alib_characters_chars "2. Character Types" of the
19/// Programmer's Manual of module \alib_characters_nl.
20using nchar= char;
21
22// #################################################################################################
23// Wide types: wchar, xchar
24// #################################################################################################
25
26
27#if DOXYGEN
28/// This type represents a wide character in \alib.
29/// Usually this is an alias for built-in C++ type \c wchar_t.
30/// As the width of the latter is compiler-specific (the width may vary with different compilers even
31/// on the same platform), the compiler-symbol \ref ALIB_CHARACTERS_SIZEOF_WCHAR may be used to
32/// manipulate its width.
33///
34///
35/// \see
36/// For details, see chapter \ref alib_characters_chars "2. Character Types" of the
37/// Programmer's Manual of module \alib_characters_nl.
38using wchar= PLATFORM_SPECIFIC;
39
40/// This type represents a second wide character type which has a width complementary to
41/// that of type \alib{characters;wchar}: If \b %wchar is 2 bytes wide, then this type aliases
42/// \c char32_t and if its width is 4 bytes, this type aliases \c char16_t.
43///
44/// While together with types \ref alib::nchar and \ref alib::wchar it forms
45/// the group of "explicit character types", it is always identical to logical type
46/// \ref alib::strangeChar.
47///
48/// \see
49/// For details, see chapter \ref alib_characters_chars "2. Character Types" of the
50/// Programmer's Manual of module \alib_characters_nl.
51using xchar = PLATFORM_SPECIFIC;
52
53#else // !DOXYGEN
54
55# if ALIB_CHARACTERS_SIZEOF_WCHAR == ALIB_SIZEOF_WCHAR_T
56# if ALIB_CHARACTERS_SIZEOF_WCHAR == 2
57 using wchar = wchar_t;
58 using xchar = char32_t;
59# else
60 using wchar = wchar_t;
61 using xchar = char16_t;
62# endif
63# else
64# if ALIB_CHARACTERS_SIZEOF_WCHAR == 2
65 using wchar = char16_t;
66 using xchar = wchar_t;
67# else
68 using wchar = char32_t;
69 using xchar = wchar_t;
70# endif
71# endif
72
73
74#endif // !DOXYGEN
75
76
77// #################################################################################################
78// Logical types: character, complementChar and strangeChar
79// #################################################################################################
80
81#if DOXYGEN
82/// This type represents a standard \alib character.
83/// The width (size) of a character is dependent on the platform and compilation flags.
84///
85/// This is why this type is called a "logical" type. The two other logical character types are
86/// #complementChar and #strangeChar.
87///
88/// \see
89/// For details, see chapter \ref alib_characters_chars "2. Character Types" of the
90/// Programmer's Manual of module \alib_characters_nl.
91using character= PLATFORM_SPECIFIC;
92
93/// This type represents a non-standard \alib character.
94/// If \ref alib::character is defined to implement a narrow character type, then this type
95/// implements a wide character and vice versa.
96/// Note, that the width of a wide character is not defined as well. It might be \c 2 or \c 4
97/// bytes wide.
98///
99/// This type is called a "logical" type. The two other logical character types are
100/// #character and #strangeChar.
101///
102/// \see
103/// For details, see chapter \ref alib_characters_chars "2. Character Types" of the
104/// Programmer's Manual of module \alib_characters_nl.
105using complementChar= PLATFORM_SPECIFIC;
106
107/// Besides types \ref alib::character and \ref alib::complementChar, this is the third
108/// logical character type defined by \alib.<br>
109/// independent of compiler defaults and optional the compiler-symbols provided, this type always
110/// is equivalent to type \alib{characters;xchar}
111///
112/// \see
113/// For details, see chapter \ref alib_characters_chars "2. Character Types" of the
114/// Programmer's Manual of module \alib_characters_nl.
115using strangeChar= PLATFORM_SPECIFIC;
116
117#define ALIB_CHAR_TYPE_ID_CHARACTER
118#define ALIB_CHAR_TYPE_ID_COMPLEMENT
119#define ALIB_CHAR_TYPE_ID_STRANGE
120
121
122#elif !ALIB_CHARACTERS_WIDE
123 using character= nchar;
124 using complementChar= wchar;
125 using strangeChar= xchar;
126#else
127 using character= wchar;
128 using complementChar= nchar;
129 using strangeChar= xchar;
130#endif
131} // namespace alib[::character]
132
133
134/// Type alias in namespace \b alib.
136
137/// Type alias in namespace \b alib.
139
140/// Type alias in namespace \b alib.
142
143/// Type alias in namespace \b alib.
145
146/// Type alias in namespace \b alib.
148
149/// Type alias in namespace \b alib.
151
152} // namespace [alib]
153
#define ALIB_EXPORT
Definition alib.inl:488
PLATFORM_SPECIFIC wchar
Definition chartypes.inl:38
PLATFORM_SPECIFIC character
Definition chartypes.inl:91
PLATFORM_SPECIFIC strangeChar
PLATFORM_SPECIFIC complementChar
PLATFORM_SPECIFIC xchar
Definition chartypes.inl:51
characters::strangeChar strangeChar
Type alias in namespace alib.
characters::complementChar complementChar
Type alias in namespace alib.
characters::wchar wchar
Type alias in namespace alib.
characters::nchar nchar
Type alias in namespace alib.
characters::xchar xchar
Type alias in namespace alib.
characters::character character
Type alias in namespace alib.