Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1055)

Unified Diff: core/include/fxcrt/fx_stream.h

Issue 1458373002: Merge to XFA: Add more overrides. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: core/include/fxcrt/fx_stream.h
diff --git a/core/include/fxcrt/fx_stream.h b/core/include/fxcrt/fx_stream.h
index c369830382f8e94765dfcd3ffebbaf73b6a62152..544eacdb5b18cfc87c65bbc65dad2e59d4a18880 100644
--- a/core/include/fxcrt/fx_stream.h
+++ b/core/include/fxcrt/fx_stream.h
@@ -62,76 +62,71 @@ class IFX_StreamWrite {
virtual void Release() = 0;
virtual FX_BOOL WriteBlock(const void* pData, size_t size) = 0;
};
+
class IFX_FileWrite : public IFX_StreamWrite {
public:
- virtual void Release() = 0;
+ // IFX_StreamWrite:
+ FX_BOOL WriteBlock(const void* pData, size_t size) override {
+ return WriteBlock(pData, GetSize(), size);
+ }
virtual FX_FILESIZE GetSize() = 0;
-
virtual FX_BOOL Flush() = 0;
-
virtual FX_BOOL WriteBlock(const void* pData,
FX_FILESIZE offset,
size_t size) = 0;
- virtual FX_BOOL WriteBlock(const void* pData, size_t size) {
- return WriteBlock(pData, GetSize(), size);
- }
};
+
class IFX_StreamRead {
public:
virtual ~IFX_StreamRead() {}
virtual void Release() = 0;
-
virtual FX_BOOL IsEOF() = 0;
-
virtual FX_FILESIZE GetPosition() = 0;
-
virtual size_t ReadBlock(void* buffer, size_t size) = 0;
};
+
class IFX_FileRead : IFX_StreamRead {
public:
- virtual void Release() = 0;
-
- virtual FX_FILESIZE GetSize() = 0;
-
- virtual FX_BOOL IsEOF() { return FALSE; }
-
- virtual FX_FILESIZE GetPosition() { return 0; }
+ // IFX_StreamRead:
+ void Release() override = 0;
+ FX_BOOL IsEOF() override { return FALSE; }
+ FX_FILESIZE GetPosition() override { return 0; }
+ size_t ReadBlock(void* buffer, size_t size) override { return 0; }
virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) = 0;
-
- virtual size_t ReadBlock(void* buffer, size_t size) { return 0; }
+ virtual FX_FILESIZE GetSize() = 0;
};
+
IFX_FileRead* FX_CreateFileRead(const FX_CHAR* filename);
IFX_FileRead* FX_CreateFileRead(const FX_WCHAR* filename);
+
class IFX_FileStream : public IFX_FileRead, public IFX_FileWrite {
public:
virtual IFX_FileStream* Retain() = 0;
- virtual void Release() = 0;
-
- virtual FX_FILESIZE GetSize() = 0;
-
- virtual FX_BOOL IsEOF() = 0;
-
- virtual FX_FILESIZE GetPosition() = 0;
-
- virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) = 0;
-
- virtual size_t ReadBlock(void* buffer, size_t size) = 0;
-
- virtual FX_BOOL WriteBlock(const void* buffer,
- FX_FILESIZE offset,
- size_t size) = 0;
- virtual FX_BOOL WriteBlock(const void* buffer, size_t size) {
+ // IFX_FileRead:
+ void Release() override = 0;
+ FX_BOOL IsEOF() override = 0;
+ FX_FILESIZE GetPosition() override = 0;
+ size_t ReadBlock(void* buffer, size_t size) override = 0;
+ FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override = 0;
+ FX_FILESIZE GetSize() override = 0;
+
+ // IFX_FileWrite:
+ FX_BOOL WriteBlock(const void* buffer,
+ FX_FILESIZE offset,
+ size_t size) override = 0;
+ FX_BOOL WriteBlock(const void* buffer, size_t size) override {
return WriteBlock(buffer, GetSize(), size);
}
-
- virtual FX_BOOL Flush() = 0;
+ FX_BOOL Flush() override = 0;
};
+
IFX_FileStream* FX_CreateFileStream(const FX_CHAR* filename, FX_DWORD dwModes);
IFX_FileStream* FX_CreateFileStream(const FX_WCHAR* filename, FX_DWORD dwModes);
+
class IFX_FileAccess {
Lei Zhang 2015/11/20 06:20:52 Conflict: XFA only.
public:
virtual ~IFX_FileAccess() {}
@@ -141,6 +136,7 @@ class IFX_FileAccess {
virtual IFX_FileStream* CreateFileStream(FX_DWORD dwModes) = 0;
};
IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath);
+
class IFX_MemoryStream : public IFX_FileStream {
public:
virtual FX_BOOL IsConsecutive() const = 0;
@@ -161,20 +157,15 @@ IFX_MemoryStream* FX_CreateMemoryStream(uint8_t* pBuffer,
IFX_MemoryStream* FX_CreateMemoryStream(FX_BOOL bConsecutive = FALSE);
class IFX_BufferRead : public IFX_StreamRead {
public:
- virtual void Release() = 0;
-
- virtual FX_BOOL IsEOF() = 0;
-
- virtual FX_FILESIZE GetPosition() = 0;
-
- virtual size_t ReadBlock(void* buffer, size_t size) = 0;
+ // IFX_StreamRead:
+ void Release() override = 0;
+ FX_BOOL IsEOF() override = 0;
+ FX_FILESIZE GetPosition() override = 0;
+ size_t ReadBlock(void* buffer, size_t size) override = 0;
virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) = 0;
-
virtual const uint8_t* GetBlockBuffer() = 0;
-
virtual size_t GetBlockSize() = 0;
-
virtual FX_FILESIZE GetBlockOffset() = 0;
};

Powered by Google App Engine
This is Rietveld 408576698