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_SRC_FXCRT_FXCRT_POSIX_H_
8 #define CORE_SRC_FXCRT_FXCRT_POSIX_H_
9 
10 #include "extension.h"
11 
12 #if _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_ || _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || _FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_
13 class CFXCRT_FileAccess_Posix : public IFXCRT_FileAccess
14 {
15 public:
16     CFXCRT_FileAccess_Posix();
17     virtual ~CFXCRT_FileAccess_Posix();
18     virtual FX_BOOL		Open(FX_BSTR fileName, FX_DWORD dwMode);
19     virtual FX_BOOL		Open(FX_WSTR fileName, FX_DWORD dwMode);
20     virtual void		Close();
21     virtual void		Release();
22     virtual FX_FILESIZE	GetSize() const;
23     virtual FX_FILESIZE	GetPosition() const;
24     virtual FX_FILESIZE	SetPosition(FX_FILESIZE pos);
25     virtual size_t		Read(void* pBuffer, size_t szBuffer);
26     virtual size_t		Write(const void* pBuffer, size_t szBuffer);
27     virtual size_t		ReadPos(void* pBuffer, size_t szBuffer, FX_FILESIZE pos);
28     virtual size_t		WritePos(const void* pBuffer, size_t szBuffer, FX_FILESIZE pos);
29     virtual FX_BOOL		Flush();
30     virtual FX_BOOL		Truncate(FX_FILESIZE szFile);
31 protected:
32     FX_INT32	m_nFD;
33 };
34 #endif
35 
36 #endif  // CORE_SRC_FXCRT_FXCRT_POSIX_H_
37