diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/cru/common/Base.hpp | 3 | ||||
-rw-r--r-- | include/cru/common/StringUtil.hpp | 6 | ||||
-rw-r--r-- | include/cru/common/io/Stream.hpp | 8 |
3 files changed, 15 insertions, 2 deletions
diff --git a/include/cru/common/Base.hpp b/include/cru/common/Base.hpp index 85f07132..bab4f733 100644 --- a/include/cru/common/Base.hpp +++ b/include/cru/common/Base.hpp @@ -12,7 +12,6 @@ #endif #include <gsl/gsl> -#include <stdexcept> #define CRU_UNUSED(entity) static_cast<void>(entity); @@ -82,7 +81,7 @@ struct CRU_BASE_API Interface { virtual ~Interface() = default; }; -[[noreturn]] inline void UnreachableCode() { std::terminate(); } +[[noreturn]] void CRU_BASE_API UnreachableCode(); using Index = gsl::index; diff --git a/include/cru/common/StringUtil.hpp b/include/cru/common/StringUtil.hpp index 27ad4b43..3c673db1 100644 --- a/include/cru/common/StringUtil.hpp +++ b/include/cru/common/StringUtil.hpp @@ -223,4 +223,10 @@ char16_t CRU_BASE_API ToLower(char16_t c); char16_t CRU_BASE_API ToUpper(char16_t c); bool CRU_BASE_API IsWhitespace(char16_t c); + +Utf8CodePointIterator CRU_BASE_API CreateUtf8Iterator(const std::byte* buffer, + Index size); +Utf8CodePointIterator CRU_BASE_API +CreateUtf8Iterator(const std::vector<std::byte>& buffer); + } // namespace cru diff --git a/include/cru/common/io/Stream.hpp b/include/cru/common/io/Stream.hpp index fedd4a0f..78beba21 100644 --- a/include/cru/common/io/Stream.hpp +++ b/include/cru/common/io/Stream.hpp @@ -2,7 +2,10 @@ #include "../Base.hpp" +#include "../String.hpp" + #include <cstddef> +#include <vector> namespace cru::io { class CRU_BASE_API Stream : public Object { @@ -33,6 +36,11 @@ class CRU_BASE_API Stream : public Object { Index Write(const char* buffer, Index offset, Index size); Index Write(const char* buffer, Index size); + virtual std::vector<std::byte> ReadAll(); + + // Utf8 encoding. + String ReadAllAsString(); + virtual void Flush(); virtual void Close(); |