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; |
11 CXML_Element *m_pXmlElmnt; | 11 CXML_Element *m_pXmlElmnt; |
12 CXML_Element *m_pElmntRdf; | 12 CXML_Element *m_pElmntRdf; |
13 CFX_CMapByteStringToPtr *m_pStringMap; | 13 CFX_CMapByteStringToPtr *m_pStringMap; |
14 } PDFDOC_METADATA, * PDFDOC_LPMETADATA; | 14 } PDFDOC_METADATA, * PDFDOC_LPMETADATA; |
15 typedef PDFDOC_METADATA const * PDFDOC_LPCMETADATA; | 15 typedef PDFDOC_METADATA const * PDFDOC_LPCMETADATA; |
16 const FX_LPCSTR gs_FPDFDOC_Metadata_Titles[] = { | 16 const FX_LPCSTR gs_FPDFDOC_Metadata_Titles[] = { |
17 "Title", "title", | 17 "Title", "title", |
18 "Subject", "description", | 18 "Subject", "description", |
19 "Author", "creator", | 19 "Author", "creator", |
20 "Keywords", "Keywords", | 20 "Keywords", "Keywords", |
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 FXSYS_memset32(m_pData, 0, sizeof(PDFDOC_METADATA)); | |
31 CFX_CMapByteStringToPtr *&pStringMap = ((PDFDOC_LPMETADATA)m_pData)->m_pStri
ngMap; | 30 CFX_CMapByteStringToPtr *&pStringMap = ((PDFDOC_LPMETADATA)m_pData)->m_pStri
ngMap; |
32 pStringMap = FX_NEW(CFX_CMapByteStringToPtr); | 31 pStringMap = FX_NEW(CFX_CMapByteStringToPtr); |
33 if (pStringMap != NULL) { | 32 if (pStringMap != NULL) { |
34 CFX_ByteString bstr; | 33 CFX_ByteString bstr; |
35 for (int i = 0; i < 18; i += 2) { | 34 for (int i = 0; i < 18; i += 2) { |
36 bstr = gs_FPDFDOC_Metadata_Titles[i]; | 35 bstr = gs_FPDFDOC_Metadata_Titles[i]; |
37 pStringMap->AddValue(bstr, (void*)gs_FPDFDOC_Metadata_Titles[i + 1])
; | 36 pStringMap->AddValue(bstr, (void*)gs_FPDFDOC_Metadata_Titles[i + 1])
; |
38 } | 37 } |
39 } | 38 } |
40 } | 39 } |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 return -1; | 142 return -1; |
144 } | 143 } |
145 CXML_Element* CPDF_Metadata::GetRoot() const | 144 CXML_Element* CPDF_Metadata::GetRoot() const |
146 { | 145 { |
147 return ((PDFDOC_LPMETADATA)m_pData)->m_pXmlElmnt; | 146 return ((PDFDOC_LPMETADATA)m_pData)->m_pXmlElmnt; |
148 } | 147 } |
149 CXML_Element* CPDF_Metadata::GetRDF() const | 148 CXML_Element* CPDF_Metadata::GetRDF() const |
150 { | 149 { |
151 return ((PDFDOC_LPMETADATA)m_pData)->m_pElmntRdf; | 150 return ((PDFDOC_LPMETADATA)m_pData)->m_pElmntRdf; |
152 } | 151 } |
OLD | NEW |