diff options
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 |