diff options
Diffstat (limited to 'include/fud_string.hpp')
-rw-r--r-- | include/fud_string.hpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/include/fud_string.hpp b/include/fud_string.hpp index 5229f26..f7e4813 100644 --- a/include/fud_string.hpp +++ b/include/fud_string.hpp @@ -47,6 +47,11 @@ class String { return m_length; } + [[nodiscard]] constexpr bool empty() const + { + return m_length == 0; + } + [[nodiscard]] constexpr size_t size() const { return m_length + 1; @@ -89,6 +94,8 @@ class String { [[nodiscard]] FudStatus nullTerminate(); + [[nodiscard]] std::optional<utf8> back(); + [[nodiscard]] constexpr size_t remainingLength() const { if (m_length >= m_capacity) { @@ -136,7 +143,7 @@ class StringView { } StringView(size_t strLen, const char* strData) : - m_length(strLen), // line break + m_length(strLen), // line break m_data{reinterpret_cast<const utf8*>(strData)} // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast) { } |