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 "../../include/fpdfdoc/fpdf_doc.h" | 7 #include "../../include/fpdfdoc/fpdf_doc.h" |
8 #include "../../include/fxcrt/fx_xml.h" | 8 #include "../../include/fxcrt/fx_xml.h" |
9 typedef struct _PDFDOC_METADATA { | 9 typedef struct _PDFDOC_METADATA { |
10 CPDF_Document *m_pDoc; | 10 CPDF_Document *m_pDoc; |
(...skipping 10 matching lines...) Expand all Loading... |
21 "Producer", "Producer", | 21 "Producer", "Producer", |
22 "Creator", "CreatorTool", | 22 "Creator", "CreatorTool", |
23 "CreationDate", "CreateDate", | 23 "CreationDate", "CreateDate", |
24 "ModDate", "ModifyDate", | 24 "ModDate", "ModifyDate", |
25 "MetadataDate", "MetadataDate" | 25 "MetadataDate", "MetadataDate" |
26 }; | 26 }; |
27 CPDF_Metadata::CPDF_Metadata() | 27 CPDF_Metadata::CPDF_Metadata() |
28 { | 28 { |
29 m_pData = FX_Alloc(PDFDOC_METADATA, 1); | 29 m_pData = FX_Alloc(PDFDOC_METADATA, 1); |
30 CFX_CMapByteStringToPtr *&pStringMap = ((PDFDOC_LPMETADATA)m_pData)->m_pStri
ngMap; | 30 CFX_CMapByteStringToPtr *&pStringMap = ((PDFDOC_LPMETADATA)m_pData)->m_pStri
ngMap; |
31 pStringMap = FX_NEW CFX_CMapByteStringToPtr; | 31 pStringMap = new CFX_CMapByteStringToPtr; |
32 if (pStringMap != NULL) { | 32 CFX_ByteString bstr; |
33 CFX_ByteString bstr; | 33 for (int i = 0; i < 18; i += 2) { |
34 for (int i = 0; i < 18; i += 2) { | 34 bstr = gs_FPDFDOC_Metadata_Titles[i]; |
35 bstr = gs_FPDFDOC_Metadata_Titles[i]; | 35 pStringMap->AddValue(bstr, (void*)gs_FPDFDOC_Metadata_Titles[i + 1]); |
36 pStringMap->AddValue(bstr, (void*)gs_FPDFDOC_Metadata_Titles[i + 1])
; | |
37 } | |
38 } | 36 } |
| 37 |
39 } | 38 } |
40 CPDF_Metadata::~CPDF_Metadata() | 39 CPDF_Metadata::~CPDF_Metadata() |
41 { | 40 { |
42 FXSYS_assert(m_pData != NULL); | 41 FXSYS_assert(m_pData != NULL); |
43 CXML_Element *&p = ((PDFDOC_LPMETADATA)m_pData)->m_pXmlElmnt; | 42 CXML_Element *&p = ((PDFDOC_LPMETADATA)m_pData)->m_pXmlElmnt; |
44 delete p; | 43 delete p; |
45 CFX_CMapByteStringToPtr *pStringMap = ((PDFDOC_LPMETADATA)m_pData)->m_pStrin
gMap; | 44 CFX_CMapByteStringToPtr *pStringMap = ((PDFDOC_LPMETADATA)m_pData)->m_pStrin
gMap; |
46 if (pStringMap) { | 45 if (pStringMap) { |
47 pStringMap->RemoveAll(); | 46 pStringMap->RemoveAll(); |
48 delete pStringMap; | 47 delete pStringMap; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 return -1; | 139 return -1; |
141 } | 140 } |
142 CXML_Element* CPDF_Metadata::GetRoot() const | 141 CXML_Element* CPDF_Metadata::GetRoot() const |
143 { | 142 { |
144 return ((PDFDOC_LPMETADATA)m_pData)->m_pXmlElmnt; | 143 return ((PDFDOC_LPMETADATA)m_pData)->m_pXmlElmnt; |
145 } | 144 } |
146 CXML_Element* CPDF_Metadata::GetRDF() const | 145 CXML_Element* CPDF_Metadata::GetRDF() const |
147 { | 146 { |
148 return ((PDFDOC_LPMETADATA)m_pData)->m_pElmntRdf; | 147 return ((PDFDOC_LPMETADATA)m_pData)->m_pElmntRdf; |
149 } | 148 } |
OLD | NEW |