diff options
author | Yuqian Yang <crupest@crupest.life> | 2025-10-17 08:37:30 +0800 |
---|---|---|
committer | Yuqian Yang <crupest@crupest.life> | 2025-10-17 08:37:30 +0800 |
commit | 3c8d5c8f732239a8b50418be27464e30b9dddeae (patch) | |
tree | 8ffb46c18e48c8463c1fb16fcacf216f296b8a1f /include/cru/platform/Check.h | |
parent | 37943858b3b260589b5dc222bb5184d2846fb6dc (diff) | |
download | cru-3c8d5c8f732239a8b50418be27464e30b9dddeae.tar.gz cru-3c8d5c8f732239a8b50418be27464e30b9dddeae.tar.bz2 cru-3c8d5c8f732239a8b50418be27464e30b9dddeae.zip |
Exception remove string.
Diffstat (limited to 'include/cru/platform/Check.h')
-rw-r--r-- | include/cru/platform/Check.h | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/include/cru/platform/Check.h b/include/cru/platform/Check.h index 202ee86e..b36b7fc1 100644 --- a/include/cru/platform/Check.h +++ b/include/cru/platform/Check.h @@ -2,42 +2,12 @@ #include "Exception.h" #include "Resource.h" -#include "cru/base/String.h" - #include <memory> #include <type_traits> namespace cru::platform { template <typename TTarget> TTarget* CheckPlatform(IPlatformResource* resource, - const String& target_platform) { - if (resource == nullptr) return nullptr; - const auto result = dynamic_cast<TTarget*>(resource); - if (result == nullptr) { - throw PlatformNotMatchException( - resource->GetPlatformId(), target_platform, - u"Try to convert resource to target platform failed."); - } - return result; -} - -template <typename TTarget, typename TSource> -std::shared_ptr<TTarget> CheckPlatform(const std::shared_ptr<TSource>& resource, - const String& target_platform) { - if (resource == nullptr) return nullptr; - static_assert(std::is_base_of_v<IPlatformResource, TSource>, - "TSource must be a subclass of INativeResource."); - const auto result = std::dynamic_pointer_cast<TTarget>(resource); - if (result == nullptr) { - throw PlatformNotMatchException( - resource->GetPlatformId(), target_platform, - u"Try to convert resource to target platform failed."); - } - return result; -} - -template <typename TTarget> -TTarget* CheckPlatform(IPlatformResource* resource, std::string target_platform) { if (resource == nullptr) return nullptr; const auto result = dynamic_cast<TTarget*>(resource); |