From e94db4695e236b42ae1be44b2605075161d5144f Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Fri, 18 Oct 2024 21:43:44 -0500 Subject: Add temporary work for formatting. --- include/fud_string_view.hpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'include/fud_string_view.hpp') diff --git a/include/fud_string_view.hpp b/include/fud_string_view.hpp index 4796003..7b4925e 100644 --- a/include/fud_string_view.hpp +++ b/include/fud_string_view.hpp @@ -15,23 +15,27 @@ * limitations under the License. */ - #ifndef FUD_STRING_VIEW_HPP #define FUD_STRING_VIEW_HPP #include "fud_status.hpp" #include "fud_utf8.hpp" +#include + namespace fud { class String; -class StringView { - public: +struct StringView { constexpr StringView() noexcept = default; + constexpr StringView(const StringView& rhs) noexcept = default; + constexpr StringView(StringView&& rhs) noexcept = default; + constexpr ~StringView() noexcept = default; + constexpr StringView& operator=(const StringView& rhs) = default; constexpr StringView& operator=(StringView&& rhs) = default; @@ -40,11 +44,13 @@ 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) { } + StringView(std::string_view rhs) noexcept : StringView(rhs.length(), rhs.data()) {} + explicit StringView(const String& fudString) noexcept; [[nodiscard]] constexpr size_t length() const @@ -85,8 +91,8 @@ class StringView { FudStatus toDouble(double& number, size_t& strLen) const; - private: size_t m_length{0}; + const utf8* m_data{nullptr}; }; -- cgit v1.2.3