diff options
Diffstat (limited to 'include/cru/base')
-rw-r--r-- | include/cru/base/Exception.h | 8 | ||||
-rw-r--r-- | include/cru/base/io/Stream.h | 14 |
2 files changed, 16 insertions, 6 deletions
diff --git a/include/cru/base/Exception.h b/include/cru/base/Exception.h index a898043a..4fcd96ad 100644 --- a/include/cru/base/Exception.h +++ b/include/cru/base/Exception.h @@ -30,9 +30,15 @@ class CRU_BASE_API Exception : public std::exception { const char* what() const noexcept override; protected: - void SetMessage(StringView message) { message_ = message.ToUtf8(); } + void SetMessage(std::string message) { message_ = std::move(message); } + void AppendMessage(std::string_view additional_message); + void AppendMessage(std::optional<std::string_view> additional_message); + [[deprecated("Use void SetMessage(std::string message) instead.")]] + void SetMessage(StringView message); + [[deprecated("Use void AppendMessage(std::string_view additional_message) instead.")]] void AppendMessage(StringView additional_message); + [[deprecated("Use void AppendMessage(std::optional<std::string_view> additional_message) instead.")]] void AppendMessage(std::optional<StringView> additional_message); private: diff --git a/include/cru/base/io/Stream.h b/include/cru/base/io/Stream.h index 0965cf22..2f02a8c2 100644 --- a/include/cru/base/io/Stream.h +++ b/include/cru/base/io/Stream.h @@ -10,12 +10,16 @@ namespace cru::io { class CRU_BASE_API StreamOperationNotSupportedException : public Exception { public: - explicit StreamOperationNotSupportedException(String operation); - - CRU_DEFAULT_DESTRUCTOR(StreamOperationNotSupportedException) + explicit StreamOperationNotSupportedException(StringView operation); + explicit StreamOperationNotSupportedException(std::string operation); public: - String GetOperation() const { return operation_; } + [[deprecated("Use GetOperationUtf8 instead.")]] + String GetOperation() const { + return String::FromUtf8(operation_); + } + + std::string GetOperationUtf8() const { return operation_; } public: static void CheckSeek(bool seekable); @@ -23,7 +27,7 @@ class CRU_BASE_API StreamOperationNotSupportedException : public Exception { static void CheckWrite(bool writable); private: - String operation_; + std::string operation_; }; class CRU_BASE_API StreamClosedException : public Exception { |