diff options
author | Yuqian Yang <crupest@crupest.life> | 2025-09-08 01:46:00 +0800 |
---|---|---|
committer | Yuqian Yang <crupest@crupest.life> | 2025-09-08 21:34:37 +0800 |
commit | 593b658eb1491d4b3103971aba6592aff2765f0e (patch) | |
tree | 526bc88c6a895c215015926c90ff38c106a94604 /include/cru/base/platform/win/Exception.h | |
parent | df550874cd546a85074edc35bebeb3cd0530622b (diff) | |
download | cru-593b658eb1491d4b3103971aba6592aff2765f0e.tar.gz cru-593b658eb1491d4b3103971aba6592aff2765f0e.tar.bz2 cru-593b658eb1491d4b3103971aba6592aff2765f0e.zip |
Fix some compile errors on Windows.
Diffstat (limited to 'include/cru/base/platform/win/Exception.h')
-rw-r--r-- | include/cru/base/platform/win/Exception.h | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/include/cru/base/platform/win/Exception.h b/include/cru/base/platform/win/Exception.h index 04bdd32c..12f3d108 100644 --- a/include/cru/base/platform/win/Exception.h +++ b/include/cru/base/platform/win/Exception.h @@ -1,25 +1,21 @@ #pragma once -#ifndef CRU_PLATFORM_WINDOWS + +#ifndef _WIN32 #error "This file can only be used on Windows." #endif #include "WinPreConfig.h" -#include "../Exception.h" +#include "../../Exception.h" #include <stdexcept> #include <string_view> namespace cru::platform::win { -class CRU_BASE_API HResultError : public platform::PlatformException { +class CRU_BASE_API HResultError : public Exception { public: explicit HResultError(HRESULT h_result); - explicit HResultError(HRESULT h_result, std::string_view message); - - CRU_DEFAULT_COPY(HResultError) - CRU_DEFAULT_MOVE(HResultError) - - ~HResultError() override = default; + HResultError(HRESULT h_result, std::string_view message); HRESULT GetHResult() const { return h_result_; } @@ -35,23 +31,16 @@ inline void ThrowIfFailed(const HRESULT h_result, std::string_view message) { if (FAILED(h_result)) throw HResultError(h_result, message); } -class CRU_BASE_API Win32Error : public platform::PlatformException { +class CRU_BASE_API Win32Error : public Exception { public: // ::GetLastError is automatically called to get the error code. // The same as Win32Error(::GetLastError(), message) explicit Win32Error(String message); Win32Error(DWORD error_code, String message); - CRU_DEFAULT_COPY(Win32Error) - CRU_DEFAULT_MOVE(Win32Error) - - ~Win32Error() override = default; - DWORD GetErrorCode() const { return error_code_; } private: DWORD error_code_; }; } // namespace cru::platform::win - -#endif |