Compile-time string literal wrapper.
More...
#include <aeongui/StringLiteral.hpp>
|
| template<size_t aStringSize> |
| constexpr | StringLiteral (const char(&aString)[aStringSize]) |
| | Construct from a string literal.
|
|
constexpr | StringLiteral () noexcept=default |
| | Default constructor.
|
|
constexpr | StringLiteral (const StringLiteral &) noexcept=default |
| | Copy constructor.
|
| constexpr | StringLiteral (StringLiteral &&aString) noexcept=default |
| | Move constructor.
|
| constexpr StringLiteral & | operator= (const StringLiteral &) noexcept=default |
| | Copy assignment operator.
|
| constexpr StringLiteral & | operator= (StringLiteral &&) noexcept=default |
| | Move assignment operator.
|
| constexpr const char * | GetString () const |
| | Get the underlying C string.
|
| constexpr size_t | GetStringSize () const |
| | Get the string size including the null terminator.
|
| constexpr bool | operator== (const StringLiteral &b) const |
| | Compare with another StringLiteral for equality.
|
| bool | operator== (const char *b) const |
| | Compare with a C string for equality.
|
| bool | operator== (const std::string &b) const |
| | Compare with a std::string for equality.
|
|
| operator std::string () const |
| | Implicit conversion to std::string.
|
Compile-time string literal wrapper.
Stores a pointer to a string literal and its size, enabling constexpr comparisons and use as hash-map keys without allocations.
◆ StringLiteral() [1/2]
template<size_t aStringSize>
| AeonGUI::StringLiteral::StringLiteral |
( |
const char(&) | aString[aStringSize] | ) |
|
|
inlineconstexpr |
Construct from a string literal.
- Template Parameters
-
| aStringSize | Size of the character array including null terminator. |
- Parameters
-
| aString | The string literal. |
◆ StringLiteral() [2/2]
| AeonGUI::StringLiteral::StringLiteral |
( |
StringLiteral && | aString | ) |
|
|
constexprdefaultnoexcept |
Move constructor.
- Parameters
-
| aString | The string literal to move from. |
◆ GetString()
| const char * AeonGUI::StringLiteral::GetString |
( |
| ) |
const |
|
inlineconstexpr |
Get the underlying C string.
- Returns
- Pointer to the null-terminated string.
◆ GetStringSize()
| size_t AeonGUI::StringLiteral::GetStringSize |
( |
| ) |
const |
|
inlineconstexpr |
Get the string size including the null terminator.
- Returns
- Size in bytes.
◆ operator=() [1/2]
Copy assignment operator.
- Returns
- Reference to this.
◆ operator=() [2/2]
Move assignment operator.
- Returns
- Reference to this.
◆ operator==() [1/3]
| bool AeonGUI::StringLiteral::operator== |
( |
const char * | b | ) |
const |
|
inline |
Compare with a C string for equality.
- Parameters
-
| b | Null-terminated C string. |
- Returns
- true if equal.
◆ operator==() [2/3]
| bool AeonGUI::StringLiteral::operator== |
( |
const std::string & | b | ) |
const |
|
inline |
Compare with a std::string for equality.
- Parameters
-
- Returns
- true if equal.
◆ operator==() [3/3]
| bool AeonGUI::StringLiteral::operator== |
( |
const StringLiteral & | b | ) |
const |
|
inlineconstexpr |
Compare with another StringLiteral for equality.
- Parameters
-
- Returns
- true if equal.
The documentation for this class was generated from the following file: