OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "../../public/fpdf_dataavail.h" | 7 #include "../../public/fpdf_dataavail.h" |
8 #include "../include/fsdk_define.h" | 8 #include "../include/fsdk_define.h" |
9 | 9 |
10 extern void ProcessParseError(FX_DWORD err_code); | 10 extern void ProcessParseError(FX_DWORD err_code); |
11 class CFPDF_FileAvailWrap : public IFX_FileAvail { | 11 class CFPDF_FileAvailWrap : public IFX_FileAvail { |
12 public: | 12 public: |
13 CFPDF_FileAvailWrap() { m_pfileAvail = NULL; } | 13 CFPDF_FileAvailWrap() { m_pfileAvail = NULL; } |
| 14 ~CFPDF_FileAvailWrap() override {} |
14 | 15 |
15 void Set(FX_FILEAVAIL* pfileAvail) { m_pfileAvail = pfileAvail; } | 16 void Set(FX_FILEAVAIL* pfileAvail) { m_pfileAvail = pfileAvail; } |
16 | 17 |
17 virtual FX_BOOL IsDataAvail(FX_FILESIZE offset, FX_DWORD size) { | 18 // IFX_FileAvail |
| 19 FX_BOOL IsDataAvail(FX_FILESIZE offset, FX_DWORD size) override { |
18 return m_pfileAvail->IsDataAvail(m_pfileAvail, offset, size); | 20 return m_pfileAvail->IsDataAvail(m_pfileAvail, offset, size); |
19 } | 21 } |
20 | 22 |
21 private: | 23 private: |
22 FX_FILEAVAIL* m_pfileAvail; | 24 FX_FILEAVAIL* m_pfileAvail; |
23 }; | 25 }; |
24 | 26 |
25 class CFPDF_FileAccessWrap : public IFX_FileRead { | 27 class CFPDF_FileAccessWrap : public IFX_FileRead { |
26 public: | 28 public: |
27 CFPDF_FileAccessWrap() { m_pFileAccess = NULL; } | 29 CFPDF_FileAccessWrap() { m_pFileAccess = NULL; } |
| 30 ~CFPDF_FileAccessWrap() override {} |
28 | 31 |
29 void Set(FPDF_FILEACCESS* pFile) { m_pFileAccess = pFile; } | 32 void Set(FPDF_FILEACCESS* pFile) { m_pFileAccess = pFile; } |
30 | 33 |
31 virtual FX_FILESIZE GetSize() { return m_pFileAccess->m_FileLen; } | 34 // IFX_FileRead |
| 35 FX_FILESIZE GetSize() override { return m_pFileAccess->m_FileLen; } |
32 | 36 |
33 virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) { | 37 FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override { |
34 return m_pFileAccess->m_GetBlock(m_pFileAccess->m_Param, offset, | 38 return m_pFileAccess->m_GetBlock(m_pFileAccess->m_Param, offset, |
35 (uint8_t*)buffer, size); | 39 (uint8_t*)buffer, size); |
36 } | 40 } |
37 | 41 |
38 virtual void Release() {} | 42 void Release() override {} |
39 | 43 |
40 private: | 44 private: |
41 FPDF_FILEACCESS* m_pFileAccess; | 45 FPDF_FILEACCESS* m_pFileAccess; |
42 }; | 46 }; |
43 | 47 |
44 class CFPDF_DownloadHintsWrap : public IFX_DownloadHints { | 48 class CFPDF_DownloadHintsWrap : public IFX_DownloadHints { |
45 public: | 49 public: |
46 CFPDF_DownloadHintsWrap(FX_DOWNLOADHINTS* pDownloadHints) { | 50 explicit CFPDF_DownloadHintsWrap(FX_DOWNLOADHINTS* pDownloadHints) { |
47 m_pDownloadHints = pDownloadHints; | 51 m_pDownloadHints = pDownloadHints; |
48 } | 52 } |
| 53 ~CFPDF_DownloadHintsWrap() override {} |
49 | 54 |
50 public: | 55 public: |
51 virtual void AddSegment(FX_FILESIZE offset, FX_DWORD size) { | 56 // IFX_DownloadHints |
| 57 void AddSegment(FX_FILESIZE offset, FX_DWORD size) override { |
52 m_pDownloadHints->AddSegment(m_pDownloadHints, offset, size); | 58 m_pDownloadHints->AddSegment(m_pDownloadHints, offset, size); |
53 } | 59 } |
54 | 60 |
55 private: | 61 private: |
56 FX_DOWNLOADHINTS* m_pDownloadHints; | 62 FX_DOWNLOADHINTS* m_pDownloadHints; |
57 }; | 63 }; |
58 | 64 |
59 class CFPDF_DataAvail { | 65 class CFPDF_DataAvail { |
60 public: | 66 public: |
61 CFPDF_DataAvail() { m_pDataAvail = NULL; } | 67 CFPDF_DataAvail() { m_pDataAvail = NULL; } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 return -1; | 139 return -1; |
134 CFPDF_DownloadHintsWrap hints_wrap(hints); | 140 CFPDF_DownloadHintsWrap hints_wrap(hints); |
135 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsFormAvail(&hints_wrap); | 141 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsFormAvail(&hints_wrap); |
136 } | 142 } |
137 | 143 |
138 DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { | 144 DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { |
139 if (avail == NULL) | 145 if (avail == NULL) |
140 return -1; | 146 return -1; |
141 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsLinearizedPDF(); | 147 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsLinearizedPDF(); |
142 } | 148 } |
OLD | NEW |