1 // Copyright 2014 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #ifndef CORE_FXCRT_CFX_FILEACCESS_POSIX_H_ 8 #define CORE_FXCRT_CFX_FILEACCESS_POSIX_H_ 9 10 #include "core/fxcrt/ifx_fileaccess.h" 11 12 #if _FX_PLATFORM_ == _FX_PLATFORM_LINUX_ || \ 13 _FX_PLATFORM_ == _FX_PLATFORM_APPLE_ || \ 14 _FX_PLATFORM_ == _FX_PLATFORM_ANDROID_ 15 class CFX_FileAccess_Posix : public IFX_FileAccess { 16 public: 17 CFX_FileAccess_Posix(); 18 ~CFX_FileAccess_Posix() override; 19 20 // IFX_FileAccess: 21 bool Open(const ByteStringView& fileName, uint32_t dwMode) override; 22 bool Open(const WideStringView& fileName, uint32_t dwMode) override; 23 void Close() override; 24 FX_FILESIZE GetSize() const override; 25 FX_FILESIZE GetPosition() const override; 26 FX_FILESIZE SetPosition(FX_FILESIZE pos) override; 27 size_t Read(void* pBuffer, size_t szBuffer) override; 28 size_t Write(const void* pBuffer, size_t szBuffer) override; 29 size_t ReadPos(void* pBuffer, size_t szBuffer, FX_FILESIZE pos) override; 30 size_t WritePos(const void* pBuffer, 31 size_t szBuffer, 32 FX_FILESIZE pos) override; 33 bool Flush() override; 34 bool Truncate(FX_FILESIZE szFile) override; 35 36 protected: 37 int32_t m_nFD; 38 }; 39 #endif 40 41 #endif // CORE_FXCRT_CFX_FILEACCESS_POSIX_H_ 42