diff options
author | crupest <crupest@outlook.com> | 2023-10-12 17:47:30 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2023-10-12 17:47:30 +0800 |
commit | 0ec90627298b8b7bdc74a3993ca58f1dde14dc26 (patch) | |
tree | 6bd6d25debf39bf969864b75599e824497b094a6 /include/cru/platform/Exception.h | |
parent | 9a077caa6d3f7eb8255ae68916dccac9b50a4333 (diff) | |
download | cru-0ec90627298b8b7bdc74a3993ca58f1dde14dc26.tar.gz cru-0ec90627298b8b7bdc74a3993ca58f1dde14dc26.tar.bz2 cru-0ec90627298b8b7bdc74a3993ca58f1dde14dc26.zip |
...
Diffstat (limited to 'include/cru/platform/Exception.h')
-rw-r--r-- | include/cru/platform/Exception.h | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/include/cru/platform/Exception.h b/include/cru/platform/Exception.h index 7d194d41..d6cda815 100644 --- a/include/cru/platform/Exception.h +++ b/include/cru/platform/Exception.h @@ -4,18 +4,26 @@ #include "cru/common/Exception.h" #include "cru/common/platform/Exception.h" +#include <optional> + 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 { +class CRU_PLATFORM_API PlatformNotMatchException : public PlatformException { public: - using Exception::Exception; // inherit constructors + PlatformNotMatchException( + String resource_platform, String target_platform, + std::optional<StringView> additional_message = std::nullopt); + + ~PlatformNotMatchException() override; - CRU_DEFAULT_COPY(UnsupportPlatformException) - CRU_DEFAULT_MOVE(UnsupportPlatformException) + String GetResourcePlatform() const; + String GetTargetPlatform() const; - CRU_DEFAULT_DESTRUCTOR(UnsupportPlatformException) + private: + String resource_platform_; + String target_platform_; }; // This exception is thrown when a resource has been disposed and not usable @@ -31,4 +39,19 @@ class CRU_PLATFORM_API ReuseException : public Exception { CRU_DEFAULT_DESTRUCTOR(ReuseException) }; + +class CRU_PLATFORM_API PlatformUnsupportedException : public PlatformException { + public: + PlatformUnsupportedException(String platform, String operation, + std::optional<StringView> additional_message); + + ~PlatformUnsupportedException() override; + + String GetPlatform() const; + String GetOperation() const; + + private: + String platform_; + String operation_; +}; } // namespace cru::platform |