aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform/Exception.h
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-02-08 16:53:51 +0800
committercrupest <crupest@outlook.com>2022-02-08 16:53:51 +0800
commit74bb9cd27242b9320f99ff4d2b50c3051576cc14 (patch)
tree744bac5799c593d1d6f81e7b09581bea626f2cde /include/cru/platform/Exception.h
parentb90c398de829d1ba5329651d75bae82f5e4085fe (diff)
downloadcru-74bb9cd27242b9320f99ff4d2b50c3051576cc14.tar.gz
cru-74bb9cd27242b9320f99ff4d2b50c3051576cc14.tar.bz2
cru-74bb9cd27242b9320f99ff4d2b50c3051576cc14.zip
...
Diffstat (limited to 'include/cru/platform/Exception.h')
-rw-r--r--include/cru/platform/Exception.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/cru/platform/Exception.h b/include/cru/platform/Exception.h
new file mode 100644
index 00000000..7d194d41
--- /dev/null
+++ b/include/cru/platform/Exception.h
@@ -0,0 +1,34 @@
+#pragma once
+#include "Base.h"
+#include "cru/common/Base.h"
+#include "cru/common/Exception.h"
+#include "cru/common/platform/Exception.h"
+
+namespace cru::platform {
+// This exception is thrown when a resource is used on another platform.
+// Of course, you can't mix resources of two different platform.
+// For example, Win32 Brush (may add in the future) with Direct Painter.
+class CRU_PLATFORM_API UnsupportPlatformException : public Exception {
+ public:
+ using Exception::Exception; // inherit constructors
+
+ CRU_DEFAULT_COPY(UnsupportPlatformException)
+ CRU_DEFAULT_MOVE(UnsupportPlatformException)
+
+ CRU_DEFAULT_DESTRUCTOR(UnsupportPlatformException)
+};
+
+// This exception is thrown when a resource has been disposed and not usable
+// again.
+// For example, calling Build twice on a GeometryBuilder::Build will lead to
+// this exception.
+class CRU_PLATFORM_API ReuseException : public Exception {
+ public:
+ using Exception::Exception; // inherit constructors
+
+ CRU_DEFAULT_COPY(ReuseException)
+ CRU_DEFAULT_MOVE(ReuseException)
+
+ CRU_DEFAULT_DESTRUCTOR(ReuseException)
+};
+} // namespace cru::platform