ludus::foundation::StaticString¶
Ludus Wiki · API overview · Browse API
Class
Capacity bytes plus a terminating zero in Capacity + 1 inline bytes and never allocates; Capacity zero is valid and holds only empty text. Sizes count bytes, not Unicode scalars, and contents are not validated as UTF-8. Counted operations preserve embedded zero bytes. Overflow preserves the entire old value; no silent truncation. Copies are plain value copies. Not internally synchronized: concurrent const calls are safe, and any non-const call needs exclusive access. | Template parameter | Description |
|---|---|
Capacity |
Maximum number of stored bytes, excluding the terminator.
|
Declared in modules/foundation/strings/include/ludus/foundation/strings/static_string.hpp
#include <ludus/foundation/strings/static_string.hpp>
template <usize Capacity>
class ludus::foundation::StaticString final
Methods¶
GetSize¶
constexpr usize ludus::foundation::StaticString< Capacity >::GetSize() const noexcept
Related types: usize
Declared in modules/foundation/strings/include/ludus/foundation/strings/static_string.hpp
IsEmpty¶
constexpr bool ludus::foundation::StaticString< Capacity >::IsEmpty() const noexcept
Declared in modules/foundation/strings/include/ludus/foundation/strings/static_string.hpp
GetView¶
std::string_view ludus::foundation::StaticString< Capacity >::GetView() const &noexcept
Declared in modules/foundation/strings/include/ludus/foundation/strings/static_string.hpp
GetView¶
std::string_view ludus::foundation::StaticString< Capacity >::GetView() const &&=delete
Declared in modules/foundation/strings/include/ludus/foundation/strings/static_string.hpp
GetData¶
const char * ludus::foundation::StaticString< Capacity >::GetData() const &noexcept
GetData()[GetSize()] is always zero, but embedded zero bytes may end a C-string reading early. Lifetime is the same as GetView. Declared in modules/foundation/strings/include/ludus/foundation/strings/static_string.hpp
GetData¶
const char * ludus::foundation::StaticString< Capacity >::GetData() const &&=delete
Declared in modules/foundation/strings/include/ludus/foundation/strings/static_string.hpp
TryAssign¶
StringStatus ludus::foundation::StaticString< Capacity >::TryAssign(std::string_view value) noexcept
value, overlap-safe. | Parameter | Description |
|---|---|
value |
Bytes to copy; it may borrow this object's own bytes.
|
Returns
value is longer than Capacity, leaving the old value unchanged. Related types: StringStatus
Declared in modules/foundation/strings/include/ludus/foundation/strings/static_string.hpp
TryAppend¶
StringStatus ludus::foundation::StaticString< Capacity >::TryAppend(std::string_view value) noexcept
value, overlap-safe. | Parameter | Description |
|---|---|
value |
Bytes to append; it may borrow this object's own bytes.
|
Returns
value does not fit the remaining capacity, leaving the old value unchanged. Related types: StringStatus
Declared in modules/foundation/strings/include/ludus/foundation/strings/static_string.hpp
Clear¶
void ludus::foundation::StaticString< Capacity >::Clear() noexcept
Declared in modules/foundation/strings/include/ludus/foundation/strings/static_string.hpp
Static methods¶
GetCapacity¶
static constexpr usize ludus::foundation::StaticString< Capacity >::GetCapacity() noexcept
Capacity, excluding the terminating zero. Related types: usize
Declared in modules/foundation/strings/include/ludus/foundation/strings/static_string.hpp