summaryrefslogtreecommitdiff
path: root/core/include/fxcrt/fx_stream.h
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2015-08-04 13:00:21 -0700
committerNico Weber <thakis@chromium.org>2015-08-04 13:00:21 -0700
commit9d8ec5a6e37e8d1d4d4edca9040de234e2d4728f (patch)
treec97037f398d714665aefccb6eb54d0969ad7030c /core/include/fxcrt/fx_stream.h
parent780cee82236d1b3b0f9b01a22424e4b8ec9a6f12 (diff)
downloadpdfium-9d8ec5a6e37e8d1d4d4edca9040de234e2d4728f.tar.xz
XFA: clang-format all pdfium code.
No behavior change. Generated by: find . -name '*.cpp' -o -name '*.h' | \ grep -E -v 'third_party|thirdparties|lpng_v163|tiff_v403' | \ xargs ../../buildtools/mac/clang-format -i Then manually merged https://codereview.chromium.org/1269223002/ See thread "tabs vs spaces" on pdfium@googlegroups.com for discussion. BUG=none
Diffstat (limited to 'core/include/fxcrt/fx_stream.h')
-rw-r--r--core/include/fxcrt/fx_stream.h240
1 files changed, 116 insertions, 124 deletions
diff --git a/core/include/fxcrt/fx_stream.h b/core/include/fxcrt/fx_stream.h
index b6fdcfcb6a..e51c2bd244 100644
--- a/core/include/fxcrt/fx_stream.h
+++ b/core/include/fxcrt/fx_stream.h
@@ -11,187 +11,179 @@
void* FX_OpenFolder(const FX_CHAR* path);
void* FX_OpenFolder(const FX_WCHAR* path);
-FX_BOOL FX_GetNextFile(void* handle, CFX_ByteString& filename, FX_BOOL& bFolder);
-FX_BOOL FX_GetNextFile(void* handle, CFX_WideString& filename, FX_BOOL& bFolder);
+FX_BOOL FX_GetNextFile(void* handle,
+ CFX_ByteString& filename,
+ FX_BOOL& bFolder);
+FX_BOOL FX_GetNextFile(void* handle,
+ CFX_WideString& filename,
+ FX_BOOL& bFolder);
void FX_CloseFolder(void* handle);
FX_WCHAR FX_GetFolderSeparator();
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-#define FX_FILESIZE int32_t
+#define FX_FILESIZE int32_t
#else
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#ifndef O_BINARY
-#define O_BINARY 0
+#define O_BINARY 0
#endif
#ifndef O_LARGEFILE
-#define O_LARGEFILE 0
+#define O_LARGEFILE 0
#endif
-#define FX_FILESIZE off_t
+#define FX_FILESIZE off_t
#endif
-#define FX_GETBYTEOFFSET32(a) 0
-#define FX_GETBYTEOFFSET40(a) 0
-#define FX_GETBYTEOFFSET48(a) 0
-#define FX_GETBYTEOFFSET56(a) 0
-#define FX_GETBYTEOFFSET24(a) ((uint8_t)(a>>24))
-#define FX_GETBYTEOFFSET16(a) ((uint8_t)(a>>16))
-#define FX_GETBYTEOFFSET8(a) ((uint8_t)(a>>8))
-#define FX_GETBYTEOFFSET0(a) ((uint8_t)(a))
-#define FX_FILEMODE_Write 0
-#define FX_FILEMODE_ReadOnly 1
-#define FX_FILEMODE_Truncate 2
-FX_BOOL FX_File_Exist(const CFX_ByteStringC& fileName);
-FX_BOOL FX_File_Exist(const CFX_WideStringC& fileName);
-FX_BOOL FX_File_Delete(const CFX_ByteStringC& fileName);
-FX_BOOL FX_File_Delete(const CFX_WideStringC& fileName);
-FX_BOOL FX_File_Copy(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst);
-FX_BOOL FX_File_Copy(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst);
-FX_BOOL FX_File_Move(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst);
-FX_BOOL FX_File_Move(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst);
-class IFX_StreamWrite
-{
-public:
- virtual ~IFX_StreamWrite() {}
- virtual void Release() = 0;
- virtual FX_BOOL WriteBlock(const void* pData, size_t size) = 0;
+#define FX_GETBYTEOFFSET32(a) 0
+#define FX_GETBYTEOFFSET40(a) 0
+#define FX_GETBYTEOFFSET48(a) 0
+#define FX_GETBYTEOFFSET56(a) 0
+#define FX_GETBYTEOFFSET24(a) ((uint8_t)(a >> 24))
+#define FX_GETBYTEOFFSET16(a) ((uint8_t)(a >> 16))
+#define FX_GETBYTEOFFSET8(a) ((uint8_t)(a >> 8))
+#define FX_GETBYTEOFFSET0(a) ((uint8_t)(a))
+#define FX_FILEMODE_Write 0
+#define FX_FILEMODE_ReadOnly 1
+#define FX_FILEMODE_Truncate 2
+FX_BOOL FX_File_Exist(const CFX_ByteStringC& fileName);
+FX_BOOL FX_File_Exist(const CFX_WideStringC& fileName);
+FX_BOOL FX_File_Delete(const CFX_ByteStringC& fileName);
+FX_BOOL FX_File_Delete(const CFX_WideStringC& fileName);
+FX_BOOL FX_File_Copy(const CFX_ByteStringC& fileNameSrc,
+ const CFX_ByteStringC& fileNameDst);
+FX_BOOL FX_File_Copy(const CFX_WideStringC& fileNameSrc,
+ const CFX_WideStringC& fileNameDst);
+FX_BOOL FX_File_Move(const CFX_ByteStringC& fileNameSrc,
+ const CFX_ByteStringC& fileNameDst);
+FX_BOOL FX_File_Move(const CFX_WideStringC& fileNameSrc,
+ const CFX_WideStringC& fileNameDst);
+class IFX_StreamWrite {
+ public:
+ virtual ~IFX_StreamWrite() {}
+ virtual void Release() = 0;
+ virtual FX_BOOL WriteBlock(const void* pData, size_t size) = 0;
};
-class IFX_FileWrite : public IFX_StreamWrite
-{
-public:
+class IFX_FileWrite : public IFX_StreamWrite {
+ public:
+ virtual void Release() = 0;
- virtual void Release() = 0;
+ virtual FX_FILESIZE GetSize() = 0;
- virtual FX_FILESIZE GetSize() = 0;
+ virtual FX_BOOL Flush() = 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);
- }
+ 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);
+ }
};
IFX_FileWrite* FX_CreateFileWrite(const FX_CHAR* filename);
IFX_FileWrite* FX_CreateFileWrite(const FX_WCHAR* filename);
-class IFX_StreamRead
-{
-public:
- virtual ~IFX_StreamRead() { }
+class IFX_StreamRead {
+ public:
+ virtual ~IFX_StreamRead() {}
- virtual void Release() = 0;
+ virtual void Release() = 0;
- virtual FX_BOOL IsEOF() = 0;
+ virtual FX_BOOL IsEOF() = 0;
- virtual FX_FILESIZE GetPosition() = 0;
+ virtual FX_FILESIZE GetPosition() = 0;
- virtual size_t ReadBlock(void* buffer, size_t size) = 0;
+ virtual size_t ReadBlock(void* buffer, size_t size) = 0;
};
-class IFX_FileRead : IFX_StreamRead
-{
-public:
- virtual void Release() = 0;
+class IFX_FileRead : IFX_StreamRead {
+ public:
+ virtual void Release() = 0;
- virtual FX_FILESIZE GetSize() = 0;
+ virtual FX_FILESIZE GetSize() = 0;
- virtual FX_BOOL IsEOF()
- {
- return FALSE;
- }
+ virtual FX_BOOL IsEOF() { return FALSE; }
- virtual FX_FILESIZE GetPosition()
- {
- return 0;
- }
+ virtual FX_FILESIZE GetPosition() { return 0; }
- virtual FX_BOOL SetRange(FX_FILESIZE offset, FX_FILESIZE size)
- {
- return FALSE;
- }
+ virtual FX_BOOL SetRange(FX_FILESIZE offset, FX_FILESIZE size) {
+ return FALSE;
+ }
- virtual void ClearRange() {}
+ virtual void ClearRange() {}
- virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) = 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 size_t ReadBlock(void* buffer, size_t size) { return 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;
+class IFX_FileStream : public IFX_FileRead, public IFX_FileWrite {
+ public:
+ virtual IFX_FileStream* Retain() = 0;
- virtual void Release() = 0;
+ virtual void Release() = 0;
- virtual FX_FILESIZE GetSize() = 0;
+ virtual FX_FILESIZE GetSize() = 0;
- virtual FX_BOOL IsEOF() = 0;
+ virtual FX_BOOL IsEOF() = 0;
- virtual FX_FILESIZE GetPosition() = 0;
+ virtual FX_FILESIZE GetPosition() = 0;
- virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) = 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 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)
- {
- return WriteBlock(buffer, GetSize(), size);
- }
+ virtual FX_BOOL WriteBlock(const void* buffer,
+ FX_FILESIZE offset,
+ size_t size) = 0;
+ virtual FX_BOOL WriteBlock(const void* buffer, size_t size) {
+ return WriteBlock(buffer, GetSize(), size);
+ }
- virtual FX_BOOL Flush() = 0;
+ virtual FX_BOOL Flush() = 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
-{
-public:
- virtual ~IFX_FileAccess() {}
- virtual void Release() = 0;
- virtual IFX_FileAccess* Retain() = 0;
- virtual void GetPath(CFX_WideString& wsPath) = 0;
- virtual IFX_FileStream* CreateFileStream(FX_DWORD dwModes) = 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 {
+ public:
+ virtual ~IFX_FileAccess() {}
+ virtual void Release() = 0;
+ virtual IFX_FileAccess* Retain() = 0;
+ virtual void GetPath(CFX_WideString& wsPath) = 0;
+ virtual IFX_FileStream* CreateFileStream(FX_DWORD dwModes) = 0;
};
IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath);
-class IFX_MemoryStream : public IFX_FileStream
-{
-public:
+class IFX_MemoryStream : public IFX_FileStream {
+ public:
+ virtual FX_BOOL IsConsecutive() const = 0;
- virtual FX_BOOL IsConsecutive() const = 0;
+ virtual void EstimateSize(size_t nInitSize, size_t nGrowSize) = 0;
- virtual void EstimateSize(size_t nInitSize, size_t nGrowSize) = 0;
+ virtual uint8_t* GetBuffer() const = 0;
- virtual uint8_t* GetBuffer() const = 0;
+ virtual void AttachBuffer(uint8_t* pBuffer,
+ size_t nSize,
+ FX_BOOL bTakeOver = FALSE) = 0;
- virtual void AttachBuffer(uint8_t* pBuffer, size_t nSize, FX_BOOL bTakeOver = FALSE) = 0;
-
- virtual void DetachBuffer() = 0;
+ virtual void DetachBuffer() = 0;
};
-IFX_MemoryStream* FX_CreateMemoryStream(uint8_t* pBuffer, size_t nSize, FX_BOOL bTakeOver = FALSE);
-IFX_MemoryStream* FX_CreateMemoryStream(FX_BOOL bConsecutive = FALSE);
-class IFX_BufferRead : public IFX_StreamRead
-{
-public:
-
- virtual void Release() = 0;
+IFX_MemoryStream* FX_CreateMemoryStream(uint8_t* pBuffer,
+ size_t nSize,
+ FX_BOOL bTakeOver = FALSE);
+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_BOOL IsEOF() = 0;
- virtual FX_FILESIZE GetPosition() = 0;
+ virtual FX_FILESIZE GetPosition() = 0;
- virtual size_t ReadBlock(void* buffer, size_t size) = 0;
+ virtual size_t ReadBlock(void* buffer, size_t size) = 0;
- virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) = 0;
+ virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) = 0;
- virtual const uint8_t* GetBlockBuffer() = 0;
+ virtual const uint8_t* GetBlockBuffer() = 0;
- virtual size_t GetBlockSize() = 0;
+ virtual size_t GetBlockSize() = 0;
- virtual FX_FILESIZE GetBlockOffset() = 0;
+ virtual FX_FILESIZE GetBlockOffset() = 0;
};
#endif // CORE_INCLUDE_FXCRT_FX_STREAM_H_