diff options
author | crupest <crupest@outlook.com> | 2022-02-03 17:55:00 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-02-03 17:55:00 +0800 |
commit | 5aca7b099c46a87a859f40110efce708200a4bc8 (patch) | |
tree | 76a0daef247ab2b2269eebdbbda10134f213d1ca /include/cru/common/platform/win | |
parent | d15172cfe1ac8558567c1b1c10c2e671b0d1f033 (diff) | |
download | cru-5aca7b099c46a87a859f40110efce708200a4bc8.tar.gz cru-5aca7b099c46a87a859f40110efce708200a4bc8.tar.bz2 cru-5aca7b099c46a87a859f40110efce708200a4bc8.zip |
...
Diffstat (limited to 'include/cru/common/platform/win')
-rw-r--r-- | include/cru/common/platform/win/BrigdeComStream.hpp | 48 | ||||
-rw-r--r-- | include/cru/common/platform/win/ComAutoInit.hpp | 21 | ||||
-rw-r--r-- | include/cru/common/platform/win/StreamConvert.hpp | 14 | ||||
-rw-r--r-- | include/cru/common/platform/win/Win32FileStream.hpp | 3 |
4 files changed, 38 insertions, 48 deletions
diff --git a/include/cru/common/platform/win/BrigdeComStream.hpp b/include/cru/common/platform/win/BrigdeComStream.hpp deleted file mode 100644 index 38b75dae..00000000 --- a/include/cru/common/platform/win/BrigdeComStream.hpp +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once -#include "../../PreConfig.hpp" -#ifdef CRU_PLATFORM_WINDOWS - -#include "WinPreConfig.hpp" - -#include "../../io/Stream.hpp" - -#include <objidlbase.h> - -namespace cru::platform::win { -class BridgeComStream : public IStream { - public: - explicit BridgeComStream(io::Stream* stream); - - CRU_DELETE_COPY(BridgeComStream) - CRU_DELETE_MOVE(BridgeComStream) - - ~BridgeComStream(); - - public: - ULONG AddRef() override; - ULONG Release() override; - HRESULT QueryInterface(REFIID riid, void** ppvObject) override; - - HRESULT Read(void* pv, ULONG cb, ULONG* pcbRead) override; - HRESULT Write(const void* pv, ULONG cb, ULONG* pcbWritten) override; - HRESULT Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, - ULARGE_INTEGER* plibNewPosition) override; - HRESULT SetSize(ULARGE_INTEGER libNewSize) override; - HRESULT CopyTo(IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, - ULARGE_INTEGER* pcbWritten) override; - HRESULT Commit(DWORD grfCommitFlags) override; - HRESULT Revert() override; - HRESULT LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, - DWORD dwLockType) override; - HRESULT UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, - DWORD dwLockType) override; - HRESULT Stat(STATSTG* pstatstg, DWORD grfStatFlag) override; - HRESULT Clone(IStream** ppstm) override; - - private: - io::Stream* stream_; - ULONG ref_count_; -}; -} // namespace cru::platform::win - -#endif diff --git a/include/cru/common/platform/win/ComAutoInit.hpp b/include/cru/common/platform/win/ComAutoInit.hpp new file mode 100644 index 00000000..131f3f30 --- /dev/null +++ b/include/cru/common/platform/win/ComAutoInit.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include "../../PreConfig.hpp" +#ifdef CRU_PLATFORM_WINDOWS + +#include "WinPreConfig.hpp" +#include "cru/common/Base.hpp" + +namespace cru::platform::win { +class CRU_BASE_API ComAutoInit { + public: + ComAutoInit(); + + CRU_DELETE_COPY(ComAutoInit) + CRU_DELETE_MOVE(ComAutoInit) + + ~ComAutoInit(); +}; +} // namespace cru::platform::win + +#endif diff --git a/include/cru/common/platform/win/StreamConvert.hpp b/include/cru/common/platform/win/StreamConvert.hpp new file mode 100644 index 00000000..80800115 --- /dev/null +++ b/include/cru/common/platform/win/StreamConvert.hpp @@ -0,0 +1,14 @@ +#pragma once +#include "../../PreConfig.hpp" + +#ifdef CRU_PLATFORM_WINDOWS + +#include "../../io/Stream.hpp" + +#include <objidlbase.h> + +namespace cru::platform::win { +CRU_BASE_API IStream* ConvertStreamToComStream(io::Stream* stream); +} + +#endif diff --git a/include/cru/common/platform/win/Win32FileStream.hpp b/include/cru/common/platform/win/Win32FileStream.hpp index ebb23357..b5511ba3 100644 --- a/include/cru/common/platform/win/Win32FileStream.hpp +++ b/include/cru/common/platform/win/Win32FileStream.hpp @@ -36,6 +36,9 @@ class CRU_BASE_API Win32FileStream : public io::Stream { void Close() override; + String GetPath() const { return path_; } + io::OpenFileFlag GetOpenFileFlags() const { return flags_; } + private: void CheckClosed(); |