aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform/Exception.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/platform/Exception.h')
-rw-r--r--include/cru/platform/Exception.h31
1 files changed, 25 insertions, 6 deletions
diff --git a/include/cru/platform/Exception.h b/include/cru/platform/Exception.h
index 4f9dc9ce..25017869 100644
--- a/include/cru/platform/Exception.h
+++ b/include/cru/platform/Exception.h
@@ -4,6 +4,7 @@
#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.
@@ -12,17 +13,26 @@ namespace cru::platform {
class CRU_PLATFORM_API PlatformNotMatchException : public PlatformException {
public:
PlatformNotMatchException(
- String resource_platform, String target_platform,
+ std::string resource_platform, std::string target_platform,
+ std::optional<std::string> additional_message = std::nullopt);
+
+ PlatformNotMatchException(
+ StringView resource_platform, StringView target_platform,
std::optional<StringView> additional_message = std::nullopt);
~PlatformNotMatchException() override;
+ [[deprecated("Use GetResourcePlatformUtf8 instead.")]]
String GetResourcePlatform() const;
+ [[deprecated("Use GetTargetPlatform instead.")]]
String GetTargetPlatform() const;
+ std::string GetResourcePlatformUtf8() const { return resource_platform_; }
+ std::string GetTargetPlatformUtf8() const { return target_platform_; }
+
private:
- String resource_platform_;
- String target_platform_;
+ std::string resource_platform_;
+ std::string target_platform_;
};
// This exception is thrown when a resource has been disposed and not usable
@@ -38,16 +48,25 @@ class CRU_PLATFORM_API ReuseException : public Exception {
class CRU_PLATFORM_API PlatformUnsupportedException : public PlatformException {
public:
- PlatformUnsupportedException(String platform, String operation,
+ PlatformUnsupportedException(
+ std::string platform, std::string operation,
+ std::optional<std::string_view> additional_message);
+
+ PlatformUnsupportedException(StringView platform, StringView operation,
std::optional<StringView> additional_message);
~PlatformUnsupportedException() override;
+ [[deprecated("Use GetPlatformUtf8 instead.")]]
String GetPlatform() const;
+ [[deprecated("Use GetOperationUtf8 instead.")]]
String GetOperation() const;
+ std::string GetPlatformUtf8() const { return platform_; }
+ std::string GetOperationUtf8() const { return operation_; }
+
private:
- String platform_;
- String operation_;
+ std::string platform_;
+ std::string operation_;
};
} // namespace cru::platform