ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::strings::CStringConstantsTraits< TChar > Struct Template Reference

Description:

template<typename TChar>
struct alib::strings::CStringConstantsTraits< TChar >

This template class has three specializations for types nchar, wchar, and xchar, which each provide the following static constexpr methods:

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 readability if the following shortcut/alias functions of namespace alib are used:
Note
Constants for nulled strings are given with NULL_STRING, NULL_COMPLEMENT_STRING, NULL_STRANGE_STRING, NULL_NSTRING, NULL_WSTRING, and NULL_XSTRING. However, those are returning type String instead of CString. For nulled objects of type CString use the keyword nullptr which performs implicit constexpr creation.
See also
See also manual chapter 6.3 String Constants.
Template Parameters
TCharThe character type.

Definition at line 559 of file cstring.inl.

Collaboration diagram for alib::strings::CStringConstantsTraits< TChar >:
[legend]

Public Static Field Index:

static constexpr CString< TChar > NewLine
 

Public Static Method Index:

static constexpr CString< TChar > DefaultWhitespaces ())
 "carriage return" and "tabulator", hence " \n\r\t".
 
static constexpr CString< TChar > EmptyString ()
 

Field Details:

◆ NewLine

template<typename TChar>
CString<TChar> alib::strings::CStringConstantsTraits< 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).

Definition at line 568 of file cstring.inl.

Method Details:

◆ DefaultWhitespaces()

template<typename TChar>
constexpr CString< TChar > alib::strings::CStringConstantsTraits< TChar >::DefaultWhitespaces ( )
inlinestaticconstexpr

"carriage return" and "tabulator", hence " \n\r\t".

Returns
A zero-terminated string containing default whitespace characters "space", "newline"

◆ EmptyString()

template<typename TChar>
constexpr CString< TChar > alib::strings::CStringConstantsTraits< TChar >::EmptyString ( )
inlinestaticconstexpr
Returns
A zero-terminated empty string.

The documentation for this struct was generated from the following file: