• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_WINDOWS_H_
8 #define CORE_FXCRT_CFX_FILEACCESS_WINDOWS_H_
9 
10 #include "build/build_config.h"
11 #include "core/fxcrt/fileaccess_iface.h"
12 #include "core/fxcrt/fx_system.h"
13 
14 #if !defined(OS_WIN)
15 #error "Included on the wrong platform"
16 #endif
17 
18 class CFX_FileAccess_Windows final : public FileAccessIface {
19  public:
20   CFX_FileAccess_Windows();
21   ~CFX_FileAccess_Windows() override;
22 
23   // FileAccessIface
24   bool Open(ByteStringView fileName, uint32_t dwMode) override;
25   bool Open(WideStringView fileName, uint32_t dwMode) override;
26   void Close() override;
27   FX_FILESIZE GetSize() const override;
28   FX_FILESIZE GetPosition() const override;
29   FX_FILESIZE SetPosition(FX_FILESIZE pos) override;
30   size_t Read(void* pBuffer, size_t szBuffer) override;
31   size_t Write(const void* pBuffer, size_t szBuffer) override;
32   size_t ReadPos(void* pBuffer, size_t szBuffer, FX_FILESIZE pos) override;
33   size_t WritePos(const void* pBuffer,
34                   size_t szBuffer,
35                   FX_FILESIZE pos) override;
36   bool Flush() override;
37   bool Truncate(FX_FILESIZE szFile) override;
38 
39  private:
40   void* m_hFile;
41 };
42 
43 #endif  // CORE_FXCRT_CFX_FILEACCESS_WINDOWS_H_
44