aboutsummaryrefslogtreecommitdiff
path: root/include/cru/common/io/Stream.h
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2023-10-05 21:41:32 +0800
committercrupest <crupest@outlook.com>2023-10-05 21:41:32 +0800
commita5d07d55ef4395a5836fd0d2cd86b94290cb2d07 (patch)
tree93559c7402df97171b84e43a67aef82d36552da1 /include/cru/common/io/Stream.h
parentc1f491712ab071030ed8ca9587c896ca2856ab97 (diff)
downloadcru-a5d07d55ef4395a5836fd0d2cd86b94290cb2d07.tar.gz
cru-a5d07d55ef4395a5836fd0d2cd86b94290cb2d07.tar.bz2
cru-a5d07d55ef4395a5836fd0d2cd86b94290cb2d07.zip
...
Diffstat (limited to 'include/cru/common/io/Stream.h')
-rw-r--r--include/cru/common/io/Stream.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/cru/common/io/Stream.h b/include/cru/common/io/Stream.h
index f833b0b9..2388874e 100644
--- a/include/cru/common/io/Stream.h
+++ b/include/cru/common/io/Stream.h
@@ -9,6 +9,27 @@
#include <vector>
namespace cru::io {
+class CRU_BASE_API StreamOperationNotSupportedException : public Exception {
+ public:
+ explicit StreamOperationNotSupportedException(String operation);
+
+ CRU_DEFAULT_COPY(StreamOperationNotSupportedException)
+ CRU_DEFAULT_MOVE(StreamOperationNotSupportedException)
+
+ CRU_DEFAULT_DESTRUCTOR(StreamOperationNotSupportedException)
+
+ public:
+ String GetOperation() const { return operation_; }
+
+ public:
+ static void CheckSeek(bool seekable);
+ static void CheckRead(bool readable);
+ static void CheckWrite(bool writable);
+
+ private:
+ String operation_;
+};
+
class CRU_BASE_API StreamAlreadyClosedException : public Exception {
public:
using Exception::Exception;
@@ -17,6 +38,8 @@ class CRU_BASE_API StreamAlreadyClosedException : public Exception {
CRU_DEFAULT_MOVE(StreamAlreadyClosedException)
CRU_DEFAULT_DESTRUCTOR(StreamAlreadyClosedException)
+
+ static void Check(bool closed);
};
class CRU_BASE_API Stream : public Object {