From 87071200872c2450c947047350132aee493033c1 Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Thu, 2 Jan 2025 15:11:51 -0600 Subject: Get basic CSV parser operating. --- include/fud_string_view.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'include/fud_string_view.hpp') diff --git a/include/fud_string_view.hpp b/include/fud_string_view.hpp index 6403c27..327bf20 100644 --- a/include/fud_string_view.hpp +++ b/include/fud_string_view.hpp @@ -68,10 +68,10 @@ struct StringView { explicit StringView(const String& fudString) noexcept; template - constexpr static StringView cStringView(const char (&input)[N]) + constexpr static StringView makeFromCString(const char (&input)[N]) { static_assert(N > 0); - return StringView{N, reinterpret_cast(input)}; + return StringView{N - 1, reinterpret_cast(input)}; } [[nodiscard]] constexpr size_t length() const @@ -84,6 +84,11 @@ struct StringView { return m_data; } + [[nodiscard]] inline const char* c_str() const + { + return reinterpret_cast(m_data); + } + constexpr const utf8& operator[](size_t index) const { if constexpr (fudBoundsChecking) { -- cgit v1.2.3