summaryrefslogtreecommitdiff
path: root/include/fud_file.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/fud_file.hpp')
-rw-r--r--include/fud_file.hpp10
1 files changed, 8 insertions, 2 deletions
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<size_t> maxExtraAttempts);
+ /** \brief Attempt to read one UTF8 sequence. */
+ DrainResult readUtf8(Utf8& sink, Option<size_t> maxExtraAttempts);
+
FudStatus setBuffer(Vector<std::byte>&& 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