template<typename TChar>
struct alib::strings::TT_StringConstants< TChar >
This template class has three specializations for types nchar
, wchar
, and xchar
, which each provide static fields:
- EmptyString,
- NewLine and
- DefaultWhitespaces.
The class is useful to implement methods that are templated with the character type they use.
- Note
- In non-templated code (that works with fixed or logical character sizes), it might lead to better readable code, if the following shortcut/alias functions of namespace alib are used:
- EmptyString, EmptyComplementString, EmptyStrangeString, EmptyNString, EmptyWString, EmptyXString,
- NewLine, ComplementNewLine, StrangeNewLine, NNewLine, WNewLine, XNewLine and
- DefaultWhitespaces, ComplementDefaultWhitespaces, StrangeDefaultWhitespaces, NDefaultWhitespaces, WDefaultWhitespaces, XDefaultWhitespaces.
- Note
- Constants for nulled strings are given with NullString, NullComplementString, NullStrangeString, NullNString, NullWString and NullXString. However, those are returning type String instead of CString. For nulled objects of type CString use keyword
nullptr
which performs implicit constexpr creation.
- See also
- See also manual chapter 6.3 String Constants.
- Template Parameters
-
Definition at line 435 of file cstring.hpp.
#include <cstring.hpp>
◆ DefaultWhitespaces()
template<typename TChar >
static constexpr CString< TChar > DefaultWhitespaces |
( |
| ) |
|
|
inlinestaticconstexpr |
- Returns
- A zero-terminated string containing default whitespace characters "space", "newline" "carriage return" and "tablulator", hence
" \n\r\t"
.
◆ EmptyString()
template<typename TChar >
static constexpr CString< TChar > EmptyString |
( |
| ) |
|
|
inlinestaticconstexpr |
- Returns
- A zero-terminated empty string.
◆ NewLine()
template<typename TChar >
static constexpr CString< TChar > NewLine |
( |
| ) |
|
|
inlinestaticconstexpr |
On Windows OS, the returned string contains characters '\r'
and '\n'
, on other platforms just character '\n'
.
- Returns
- A zero-terminated string containing platform dependent "newline" charcater(s).
The documentation for this struct was generated from the following file: