From 255fa256b106506e0c951f704314c5c633217468 Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Wed, 25 Sep 2024 11:25:25 -0500 Subject: Further expansion of string api. --- include/fud_string.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'include/fud_string.hpp') 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 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(strData)} // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast) { } -- cgit v1.2.3