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 "../../public/fpdf_formfill.h" | 8 #include "../../public/fpdf_formfill.h" |
9 #include "../include/fsdk_define.h" | 9 #include "../include/fsdk_define.h" |
10 #include "../include/fpdfxfa/fpdfxfa_doc.h" | 10 #include "../include/fpdfxfa/fpdfxfa_doc.h" |
11 #include "../include/fpdfxfa/fpdfxfa_app.h" | 11 #include "../include/fpdfxfa/fpdfxfa_app.h" |
12 | 12 |
13 extern void ProcessParseError(FX_DWORD err_code); | 13 extern void ProcessParseError(FX_DWORD err_code); |
14 class CFPDF_FileAvailWrap : public IFX_FileAvail { | 14 class CFPDF_FileAvailWrap : public IFX_FileAvail { |
15 public: | 15 public: |
16 CFPDF_FileAvailWrap() { m_pfileAvail = NULL; } | 16 CFPDF_FileAvailWrap() { m_pfileAvail = NULL; } |
| 17 ~CFPDF_FileAvailWrap() override {} |
17 | 18 |
18 void Set(FX_FILEAVAIL* pfileAvail) { m_pfileAvail = pfileAvail; } | 19 void Set(FX_FILEAVAIL* pfileAvail) { m_pfileAvail = pfileAvail; } |
19 | 20 |
20 virtual FX_BOOL IsDataAvail(FX_FILESIZE offset, FX_DWORD size) { | 21 // IFX_FileAvail |
| 22 FX_BOOL IsDataAvail(FX_FILESIZE offset, FX_DWORD size) override { |
21 return m_pfileAvail->IsDataAvail(m_pfileAvail, offset, size); | 23 return m_pfileAvail->IsDataAvail(m_pfileAvail, offset, size); |
22 } | 24 } |
23 | 25 |
24 private: | 26 private: |
25 FX_FILEAVAIL* m_pfileAvail; | 27 FX_FILEAVAIL* m_pfileAvail; |
26 }; | 28 }; |
27 | 29 |
28 class CFPDF_FileAccessWrap : public IFX_FileRead { | 30 class CFPDF_FileAccessWrap : public IFX_FileRead { |
29 public: | 31 public: |
30 CFPDF_FileAccessWrap() { m_pFileAccess = NULL; } | 32 CFPDF_FileAccessWrap() { m_pFileAccess = NULL; } |
| 33 ~CFPDF_FileAccessWrap() override {} |
31 | 34 |
32 void Set(FPDF_FILEACCESS* pFile) { m_pFileAccess = pFile; } | 35 void Set(FPDF_FILEACCESS* pFile) { m_pFileAccess = pFile; } |
33 | 36 |
34 virtual FX_FILESIZE GetSize() { return m_pFileAccess->m_FileLen; } | 37 // IFX_FileRead |
| 38 FX_FILESIZE GetSize() override { return m_pFileAccess->m_FileLen; } |
35 | 39 |
36 virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) { | 40 FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override { |
37 return m_pFileAccess->m_GetBlock(m_pFileAccess->m_Param, offset, | 41 return m_pFileAccess->m_GetBlock(m_pFileAccess->m_Param, offset, |
38 (uint8_t*)buffer, size); | 42 (uint8_t*)buffer, size); |
39 } | 43 } |
40 | 44 |
41 virtual void Release() {} | 45 void Release() override {} |
42 | 46 |
43 private: | 47 private: |
44 FPDF_FILEACCESS* m_pFileAccess; | 48 FPDF_FILEACCESS* m_pFileAccess; |
45 }; | 49 }; |
46 | 50 |
47 class CFPDF_DownloadHintsWrap : public IFX_DownloadHints { | 51 class CFPDF_DownloadHintsWrap : public IFX_DownloadHints { |
48 public: | 52 public: |
49 CFPDF_DownloadHintsWrap(FX_DOWNLOADHINTS* pDownloadHints) { | 53 explicit CFPDF_DownloadHintsWrap(FX_DOWNLOADHINTS* pDownloadHints) { |
50 m_pDownloadHints = pDownloadHints; | 54 m_pDownloadHints = pDownloadHints; |
51 } | 55 } |
| 56 ~CFPDF_DownloadHintsWrap() override {} |
52 | 57 |
53 public: | 58 public: |
54 virtual void AddSegment(FX_FILESIZE offset, FX_DWORD size) { | 59 // IFX_DownloadHints |
| 60 void AddSegment(FX_FILESIZE offset, FX_DWORD size) override { |
55 m_pDownloadHints->AddSegment(m_pDownloadHints, offset, size); | 61 m_pDownloadHints->AddSegment(m_pDownloadHints, offset, size); |
56 } | 62 } |
57 | 63 |
58 private: | 64 private: |
59 FX_DOWNLOADHINTS* m_pDownloadHints; | 65 FX_DOWNLOADHINTS* m_pDownloadHints; |
60 }; | 66 }; |
61 | 67 |
62 class CFPDF_DataAvail { | 68 class CFPDF_DataAvail { |
63 public: | 69 public: |
64 CFPDF_DataAvail() { m_pDataAvail = NULL; } | 70 CFPDF_DataAvail() { m_pDataAvail = NULL; } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 return -1; | 145 return -1; |
140 CFPDF_DownloadHintsWrap hints_wrap(hints); | 146 CFPDF_DownloadHintsWrap hints_wrap(hints); |
141 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsFormAvail(&hints_wrap); | 147 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsFormAvail(&hints_wrap); |
142 } | 148 } |
143 | 149 |
144 DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { | 150 DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { |
145 if (avail == NULL) | 151 if (avail == NULL) |
146 return -1; | 152 return -1; |
147 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsLinearizedPDF(); | 153 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsLinearizedPDF(); |
148 } | 154 } |
OLD | NEW |