summaryrefslogtreecommitdiff
path: root/core/src/fxcrt
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fxcrt')
-rw-r--r--core/src/fxcrt/extension.h7
-rw-r--r--core/src/fxcrt/fxcrt_platforms.h34
-rw-r--r--core/src/fxcrt/fxcrt_posix.h34
-rw-r--r--core/src/fxcrt/fxcrt_windows.h34
-rw-r--r--core/src/fxcrt/xml_int.h44
5 files changed, 85 insertions, 68 deletions
diff --git a/core/src/fxcrt/extension.h b/core/src/fxcrt/extension.h
index 7d14cb0b9a..a712fa3770 100644
--- a/core/src/fxcrt/extension.h
+++ b/core/src/fxcrt/extension.h
@@ -30,10 +30,11 @@ class IFXCRT_FileAccess {
virtual FX_BOOL Truncate(FX_FILESIZE szFile) = 0;
};
IFXCRT_FileAccess* FXCRT_FileAccess_Create();
+
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();
}
@@ -70,6 +71,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
@@ -94,7 +96,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]);
@@ -287,6 +289,7 @@ class CFX_MemoryStream final : public IFX_MemoryStream {
return TRUE;
}
};
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/core/src/fxcrt/fxcrt_platforms.h b/core/src/fxcrt/fxcrt_platforms.h
index 5870c76469..393df694eb 100644
--- a/core/src/fxcrt/fxcrt_platforms.h
+++ b/core/src/fxcrt/fxcrt_platforms.h
@@ -15,22 +15,24 @@ void FXCRT_GetFileModeString(FX_DWORD dwModes, CFX_WideString& wsMode);
class CFXCRT_FileAccess_CRT : public IFXCRT_FileAccess {
public:
CFXCRT_FileAccess_CRT();
- virtual ~CFXCRT_FileAccess_CRT();
- virtual FX_BOOL Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode);
- virtual FX_BOOL Open(const CFX_WideStringC& fileName, FX_DWORD dwMode);
- virtual void Close();
- virtual void Release();
- virtual FX_FILESIZE GetSize() const;
- virtual FX_FILESIZE GetPosition() const;
- virtual FX_FILESIZE SetPosition(FX_FILESIZE pos);
- virtual size_t Read(void* pBuffer, size_t szBuffer);
- virtual size_t Write(const void* pBuffer, size_t szBuffer);
- virtual size_t ReadPos(void* pBuffer, size_t szBuffer, FX_FILESIZE pos);
- virtual size_t WritePos(const void* pBuffer,
- size_t szBuffer,
- FX_FILESIZE pos);
- virtual FX_BOOL Flush();
- virtual FX_BOOL Truncate(FX_FILESIZE szFile);
+ ~CFXCRT_FileAccess_CRT() override;
+
+ // IFXCRT_FileAccess
+ FX_BOOL Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode) override;
+ FX_BOOL Open(const CFX_WideStringC& fileName, FX_DWORD dwMode) override;
+ void Close() override;
+ void Release() override;
+ FX_FILESIZE GetSize() const override;
+ FX_FILESIZE GetPosition() const override;
+ FX_FILESIZE SetPosition(FX_FILESIZE pos) override;
+ size_t Read(void* pBuffer, size_t szBuffer) override;
+ size_t Write(const void* pBuffer, size_t szBuffer) override;
+ size_t ReadPos(void* pBuffer, size_t szBuffer, FX_FILESIZE pos) override;
+ size_t WritePos(const void* pBuffer,
+ size_t szBuffer,
+ FX_FILESIZE pos) override;
+ FX_BOOL Flush() override;
+ FX_BOOL Truncate(FX_FILESIZE szFile) override;
protected:
FXSYS_FILE* m_hFile;
diff --git a/core/src/fxcrt/fxcrt_posix.h b/core/src/fxcrt/fxcrt_posix.h
index 19e11da4a8..b24721dddd 100644
--- a/core/src/fxcrt/fxcrt_posix.h
+++ b/core/src/fxcrt/fxcrt_posix.h
@@ -15,22 +15,24 @@
class CFXCRT_FileAccess_Posix : public IFXCRT_FileAccess {
public:
CFXCRT_FileAccess_Posix();
- virtual ~CFXCRT_FileAccess_Posix();
- virtual FX_BOOL Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode);
- virtual FX_BOOL Open(const CFX_WideStringC& fileName, FX_DWORD dwMode);
- virtual void Close();
- virtual void Release();
- virtual FX_FILESIZE GetSize() const;
- virtual FX_FILESIZE GetPosition() const;
- virtual FX_FILESIZE SetPosition(FX_FILESIZE pos);
- virtual size_t Read(void* pBuffer, size_t szBuffer);
- virtual size_t Write(const void* pBuffer, size_t szBuffer);
- virtual size_t ReadPos(void* pBuffer, size_t szBuffer, FX_FILESIZE pos);
- virtual size_t WritePos(const void* pBuffer,
- size_t szBuffer,
- FX_FILESIZE pos);
- virtual FX_BOOL Flush();
- virtual FX_BOOL Truncate(FX_FILESIZE szFile);
+ ~CFXCRT_FileAccess_Posix() override;
+
+ // IFXCRT_FileAccess
+ FX_BOOL Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode) override;
+ FX_BOOL Open(const CFX_WideStringC& fileName, FX_DWORD dwMode) override;
+ void Close() override;
+ void Release() override;
+ FX_FILESIZE GetSize() const override;
+ FX_FILESIZE GetPosition() const override;
+ FX_FILESIZE SetPosition(FX_FILESIZE pos) override;
+ size_t Read(void* pBuffer, size_t szBuffer) override;
+ size_t Write(const void* pBuffer, size_t szBuffer) override;
+ size_t ReadPos(void* pBuffer, size_t szBuffer, FX_FILESIZE pos) override;
+ size_t WritePos(const void* pBuffer,
+ size_t szBuffer,
+ FX_FILESIZE pos) override;
+ FX_BOOL Flush() override;
+ FX_BOOL Truncate(FX_FILESIZE szFile) override;
protected:
int32_t m_nFD;
diff --git a/core/src/fxcrt/fxcrt_windows.h b/core/src/fxcrt/fxcrt_windows.h
index bb00410e19..b3a20a91e5 100644
--- a/core/src/fxcrt/fxcrt_windows.h
+++ b/core/src/fxcrt/fxcrt_windows.h
@@ -13,22 +13,24 @@
class CFXCRT_FileAccess_Win64 : public IFXCRT_FileAccess {
public:
CFXCRT_FileAccess_Win64();
- virtual ~CFXCRT_FileAccess_Win64();
- virtual FX_BOOL Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode);
- virtual FX_BOOL Open(const CFX_WideStringC& fileName, FX_DWORD dwMode);
- virtual void Close();
- virtual void Release();
- virtual FX_FILESIZE GetSize() const;
- virtual FX_FILESIZE GetPosition() const;
- virtual FX_FILESIZE SetPosition(FX_FILESIZE pos);
- virtual size_t Read(void* pBuffer, size_t szBuffer);
- virtual size_t Write(const void* pBuffer, size_t szBuffer);
- virtual size_t ReadPos(void* pBuffer, size_t szBuffer, FX_FILESIZE pos);
- virtual size_t WritePos(const void* pBuffer,
- size_t szBuffer,
- FX_FILESIZE pos);
- virtual FX_BOOL Flush();
- virtual FX_BOOL Truncate(FX_FILESIZE szFile);
+ ~CFXCRT_FileAccess_Win64() override;
+
+ // IFXCRT_FileAccess
+ FX_BOOL Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode) override;
+ FX_BOOL Open(const CFX_WideStringC& fileName, FX_DWORD dwMode) override;
+ void Close() override;
+ void Release() override;
+ FX_FILESIZE GetSize() const override;
+ FX_FILESIZE GetPosition() const override;
+ FX_FILESIZE SetPosition(FX_FILESIZE pos) override;
+ size_t Read(void* pBuffer, size_t szBuffer) override;
+ size_t Write(const void* pBuffer, size_t szBuffer) override;
+ size_t ReadPos(void* pBuffer, size_t szBuffer, FX_FILESIZE pos) override;
+ size_t WritePos(const void* pBuffer,
+ size_t szBuffer,
+ FX_FILESIZE pos) override;
+ FX_BOOL Flush() override;
+ FX_BOOL Truncate(FX_FILESIZE szFile) override;
protected:
void* m_hFile;
diff --git a/core/src/fxcrt/xml_int.h b/core/src/fxcrt/xml_int.h
index 1008436c84..6020f45819 100644
--- a/core/src/fxcrt/xml_int.h
+++ b/core/src/fxcrt/xml_int.h
@@ -13,12 +13,14 @@ class CXML_DataBufAcc : public IFX_BufferRead {
public:
CXML_DataBufAcc(const uint8_t* pBuffer, size_t size)
: m_pBuffer(pBuffer), m_dwSize(size), m_dwCurPos(0) {}
- virtual ~CXML_DataBufAcc() {}
- virtual void Release() { delete this; }
- virtual FX_BOOL IsEOF() { return m_dwCurPos >= m_dwSize; }
- virtual FX_FILESIZE GetPosition() { return (FX_FILESIZE)m_dwCurPos; }
- virtual size_t ReadBlock(void* buffer, size_t size) { return 0; }
- virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) {
+ ~CXML_DataBufAcc() override {}
+
+ // IFX_BufferRead
+ void Release() override { delete this; }
+ FX_BOOL IsEOF() override { return m_dwCurPos >= m_dwSize; }
+ FX_FILESIZE GetPosition() override { return (FX_FILESIZE)m_dwCurPos; }
+ size_t ReadBlock(void* buffer, size_t size) override { return 0; }
+ FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) override {
if (bRestart) {
m_dwCurPos = 0;
}
@@ -28,15 +30,16 @@ class CXML_DataBufAcc : public IFX_BufferRead {
}
return FALSE;
}
- virtual const uint8_t* GetBlockBuffer() { return m_pBuffer; }
- virtual size_t GetBlockSize() { return m_dwSize; }
- virtual FX_FILESIZE GetBlockOffset() { return 0; }
+ const uint8_t* GetBlockBuffer() override { return m_pBuffer; }
+ size_t GetBlockSize() override { return m_dwSize; }
+ FX_FILESIZE GetBlockOffset() override { return 0; }
protected:
const uint8_t* m_pBuffer;
size_t m_dwSize;
size_t m_dwCurPos;
};
+
#define FX_XMLDATASTREAM_BufferSize (32 * 1024)
class CXML_DataStmAcc : public IFX_BufferRead {
public:
@@ -44,18 +47,21 @@ class CXML_DataStmAcc : public IFX_BufferRead {
: m_pFileRead(pFileRead), m_pBuffer(NULL), m_nStart(0), m_dwSize(0) {
FXSYS_assert(m_pFileRead != NULL);
}
- virtual ~CXML_DataStmAcc() {
+ ~CXML_DataStmAcc() override {
if (m_pBuffer) {
FX_Free(m_pBuffer);
}
}
- virtual void Release() { delete this; }
- virtual FX_BOOL IsEOF() {
+
+ void Release() override { delete this; }
+ FX_BOOL IsEOF() override {
return m_nStart + (FX_FILESIZE)m_dwSize >= m_pFileRead->GetSize();
}
- virtual FX_FILESIZE GetPosition() { return m_nStart + (FX_FILESIZE)m_dwSize; }
- virtual size_t ReadBlock(void* buffer, size_t size) { return 0; }
- virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) {
+ FX_FILESIZE GetPosition() override {
+ return m_nStart + (FX_FILESIZE)m_dwSize;
+ }
+ size_t ReadBlock(void* buffer, size_t size) override { return 0; }
+ FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) override {
if (bRestart) {
m_nStart = 0;
}
@@ -70,9 +76,9 @@ class CXML_DataStmAcc : public IFX_BufferRead {
}
return m_pFileRead->ReadBlock(m_pBuffer, m_nStart, m_dwSize);
}
- virtual const uint8_t* GetBlockBuffer() { return (const uint8_t*)m_pBuffer; }
- virtual size_t GetBlockSize() { return m_dwSize; }
- virtual FX_FILESIZE GetBlockOffset() { return m_nStart; }
+ const uint8_t* GetBlockBuffer() override { return (const uint8_t*)m_pBuffer; }
+ size_t GetBlockSize() override { return m_dwSize; }
+ FX_FILESIZE GetBlockOffset() override { return m_nStart; }
protected:
IFX_FileRead* m_pFileRead;
@@ -80,6 +86,7 @@ class CXML_DataStmAcc : public IFX_BufferRead {
FX_FILESIZE m_nStart;
size_t m_dwSize;
};
+
class CXML_Parser {
public:
~CXML_Parser();
@@ -113,6 +120,7 @@ class CXML_Parser {
CXML_Element* pElement);
void InsertCDATASegment(CFX_UTF8Decoder& decoder, CXML_Element* pElement);
};
+
void FX_XML_SplitQualifiedName(const CFX_ByteStringC& bsFullName,
CFX_ByteStringC& bsSpace,
CFX_ByteStringC& bsName);