summaryrefslogtreecommitdiff
path: root/core/src/fxcrt/extension.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fxcrt/extension.h')
-rw-r--r--core/src/fxcrt/extension.h27
1 files changed, 16 insertions, 11 deletions
diff --git a/core/src/fxcrt/extension.h b/core/src/fxcrt/extension.h
index 0fdf8ab7bf..9960c03349 100644
--- a/core/src/fxcrt/extension.h
+++ b/core/src/fxcrt/extension.h
@@ -30,40 +30,43 @@ class IFXCRT_FileAccess {
virtual FX_BOOL Truncate(FX_FILESIZE szFile) = 0;
};
IFXCRT_FileAccess* FXCRT_FileAccess_Create();
+
class CFX_CRTFileAccess : public IFX_FileAccess {
public:
CFX_CRTFileAccess() : m_RefCount(0) {}
- virtual void Release() {
+ // IFX_FileAccess
+ void Release() override {
if (--m_RefCount == 0)
delete this;
}
- IFX_FileAccess* Retain() {
+ IFX_FileAccess* Retain() override {
m_RefCount++;
return (IFX_FileAccess*)this;
}
- virtual FX_BOOL Init(const CFX_WideStringC& wsPath) {
+ void GetPath(CFX_WideString& wsPath) override { wsPath = m_path; }
+
+ IFX_FileStream* CreateFileStream(FX_DWORD dwModes) override {
+ return FX_CreateFileStream(m_path, dwModes);
+ }
+
+ FX_BOOL Init(const CFX_WideStringC& wsPath) {
m_path = wsPath;
m_RefCount = 1;
return TRUE;
}
- virtual void GetPath(CFX_WideString& wsPath) { wsPath = m_path; }
-
- virtual IFX_FileStream* CreateFileStream(FX_DWORD dwModes) {
- return FX_CreateFileStream(m_path, dwModes);
- }
-
protected:
CFX_WideString m_path;
FX_DWORD m_RefCount;
};
+
class CFX_CRTFileStream final : public IFX_FileStream {
public:
CFX_CRTFileStream(IFXCRT_FileAccess* pFA) : m_pFile(pFA), m_dwCount(1) {}
- ~CFX_CRTFileStream() {
+ ~CFX_CRTFileStream() override {
if (m_pFile) {
m_pFile->Release();
}
@@ -100,6 +103,7 @@ class CFX_CRTFileStream final : public IFX_FileStream {
IFXCRT_FileAccess* m_pFile;
FX_DWORD m_dwCount;
};
+
#define FX_MEMSTREAM_BlockSize (64 * 1024)
#define FX_MEMSTREAM_Consecutive 0x01
#define FX_MEMSTREAM_TakeOver 0x02
@@ -124,7 +128,7 @@ class CFX_MemoryStream final : public IFX_MemoryStream {
m_dwFlags =
FX_MEMSTREAM_Consecutive | (bTakeOver ? FX_MEMSTREAM_TakeOver : 0);
}
- ~CFX_MemoryStream() {
+ ~CFX_MemoryStream() override {
if (m_dwFlags & FX_MEMSTREAM_TakeOver) {
for (int32_t i = 0; i < m_Blocks.GetSize(); i++) {
FX_Free((uint8_t*)m_Blocks[i]);
@@ -317,6 +321,7 @@ class CFX_MemoryStream final : public IFX_MemoryStream {
return TRUE;
}
};
+
#ifdef __cplusplus
extern "C" {
#endif