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_file.hpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'include/fud_file.hpp') diff --git a/include/fud_file.hpp b/include/fud_file.hpp index e7c485c..6f1acbf 100644 --- a/include/fud_file.hpp +++ b/include/fud_file.hpp @@ -38,8 +38,7 @@ enum class FileAccessMode : uint8_t ReadWrite = Read | Write }; -// enum class OpenFlagEnum : uint32_t -enum class OpenFlagEnum : uint8_t +enum class OpenFlagEnum : uint16_t { Append = 0x01, Truncate = Append << 1, @@ -207,6 +206,9 @@ class BufferedRegularFile { /** \brief Read from file as source to sink. */ DrainResult read(std::byte* sink, size_t length, Option maxExtraAttempts); + /** \brief Attempt to read one UTF8 sequence. */ + DrainResult readUtf8(Utf8& sink, Option maxExtraAttempts); + FudStatus setBuffer(Vector&& buffer, bool discardOldBuffer); DrainResult flush(size_t maxExtraAttempts = 0); @@ -261,6 +263,10 @@ class BufferedRegularFile { }; Operation m_lastOperation{Operation::None}; + + DrainResult validateBufferedIO(const std::byte* pointer, Operation requestedOperation); + + void drainReadBuffer(std::byte*& sink, size_t& length, DrainResult& result); }; } // namespace fud -- cgit v1.2.3