aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform/Exception.h
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-11-03 20:12:12 +0800
committerYuqian Yang <crupest@crupest.life>2025-11-03 20:12:12 +0800
commit76746163e04555eb129fc2590ee8b0312fad872c (patch)
tree673c606c245456b13510caadaa37b67b19b6973a /include/cru/platform/Exception.h
parent06f16479ae1b727252404b763b60c924e3fe7903 (diff)
downloadcru-76746163e04555eb129fc2590ee8b0312fad872c.tar.gz
cru-76746163e04555eb129fc2590ee8b0312fad872c.tar.bz2
cru-76746163e04555eb129fc2590ee8b0312fad872c.zip
Merge platform/Exception.h Check.h to Base.h.
Diffstat (limited to 'include/cru/platform/Exception.h')
-rw-r--r--include/cru/platform/Exception.h55
1 files changed, 0 insertions, 55 deletions
diff --git a/include/cru/platform/Exception.h b/include/cru/platform/Exception.h
deleted file mode 100644
index f43162d1..00000000
--- a/include/cru/platform/Exception.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#pragma once
-#include "Base.h"
-#include "cru/base/Base.h"
-#include "cru/base/Exception.h"
-
-#include <optional>
-#include <string_view>
-
-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 PlatformNotMatchException : public PlatformException {
- public:
- PlatformNotMatchException(
- std::string resource_platform, std::string target_platform,
- std::optional<std::string_view> additional_message = std::nullopt);
-
- ~PlatformNotMatchException() override;
-
- std::string GetResourcePlatformUtf8() const { return resource_platform_; }
- std::string GetTargetPlatformUtf8() const { return target_platform_; }
-
- private:
- std::string resource_platform_;
- std::string target_platform_;
-};
-
-// 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_DESTRUCTOR(ReuseException)
-};
-
-class CRU_PLATFORM_API PlatformUnsupportedException : public PlatformException {
- public:
- PlatformUnsupportedException(
- std::string platform, std::string operation,
- std::optional<std::string_view> additional_message);
-
- ~PlatformUnsupportedException() override;
-
- std::string GetPlatformUtf8() const { return platform_; }
- std::string GetOperationUtf8() const { return operation_; }
-
- private:
- std::string platform_;
- std::string operation_;
-};
-} // namespace cru::platform