Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Side by Side Diff: core/src/fpdfdoc/doc_action.cpp

Issue 1541703003: Use std::map as CPDF_Dictionary's underlying store. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comments, rebase, fix embedder test Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "core/include/fpdfdoc/fpdf_doc.h" 7 #include "core/include/fpdfdoc/fpdf_doc.h"
8 8
9 CPDF_Dest CPDF_Action::GetDest(CPDF_Document* pDoc) const { 9 CPDF_Dest CPDF_Action::GetDest(CPDF_Document* pDoc) const {
10 if (!m_pDict) { 10 if (!m_pDict) {
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 "WC", "WS", "DS", "WP", "DP", ""}; 250 "WC", "WS", "DS", "WP", "DP", ""};
251 FX_BOOL CPDF_AAction::ActionExist(AActionType eType) const { 251 FX_BOOL CPDF_AAction::ActionExist(AActionType eType) const {
252 return m_pDict && m_pDict->KeyExist(g_sAATypes[(int)eType]); 252 return m_pDict && m_pDict->KeyExist(g_sAATypes[(int)eType]);
253 } 253 }
254 CPDF_Action CPDF_AAction::GetAction(AActionType eType) const { 254 CPDF_Action CPDF_AAction::GetAction(AActionType eType) const {
255 if (!m_pDict) { 255 if (!m_pDict) {
256 return CPDF_Action(); 256 return CPDF_Action();
257 } 257 }
258 return CPDF_Action(m_pDict->GetDict(g_sAATypes[(int)eType])); 258 return CPDF_Action(m_pDict->GetDict(g_sAATypes[(int)eType]));
259 } 259 }
260 FX_POSITION CPDF_AAction::GetStartPos() const {
261 if (!m_pDict) {
262 return NULL;
263 }
264 return m_pDict->GetStartPos();
265 }
266 CPDF_Action CPDF_AAction::GetNextAction(FX_POSITION& pos,
267 AActionType& eType) const {
268 if (!m_pDict) {
269 return CPDF_Action();
270 }
271 CFX_ByteString csKey;
272 CPDF_Object* pObj = m_pDict->GetNextElement(pos, csKey);
273 if (!pObj) {
274 return CPDF_Action();
275 }
276 CPDF_Object* pDirect = pObj->GetDirect();
277 CPDF_Dictionary* pDict = ToDictionary(pDirect);
278 if (!pDict)
279 return CPDF_Action();
280
281 int i = 0;
282 while (g_sAATypes[i][0] != '\0') {
283 if (csKey == g_sAATypes[i]) {
284 break;
285 }
286 i++;
287 }
288 eType = (AActionType)i;
289 return CPDF_Action(pDict);
290 }
291 260
292 CPDF_DocJSActions::CPDF_DocJSActions(CPDF_Document* pDoc) : m_pDocument(pDoc) {} 261 CPDF_DocJSActions::CPDF_DocJSActions(CPDF_Document* pDoc) : m_pDocument(pDoc) {}
293 262
294 int CPDF_DocJSActions::CountJSActions() const { 263 int CPDF_DocJSActions::CountJSActions() const {
295 ASSERT(m_pDocument); 264 ASSERT(m_pDocument);
296 CPDF_NameTree name_tree(m_pDocument, "JavaScript"); 265 CPDF_NameTree name_tree(m_pDocument, "JavaScript");
297 return name_tree.GetCount(); 266 return name_tree.GetCount();
298 } 267 }
299 CPDF_Action CPDF_DocJSActions::GetJSAction(int index, 268 CPDF_Action CPDF_DocJSActions::GetJSAction(int index,
300 CFX_ByteString& csName) const { 269 CFX_ByteString& csName) const {
(...skipping 12 matching lines...) Expand all
313 if (!ToDictionary(pAction)) { 282 if (!ToDictionary(pAction)) {
314 return CPDF_Action(); 283 return CPDF_Action();
315 } 284 }
316 return CPDF_Action(pAction->GetDict()); 285 return CPDF_Action(pAction->GetDict());
317 } 286 }
318 int CPDF_DocJSActions::FindJSAction(const CFX_ByteString& csName) const { 287 int CPDF_DocJSActions::FindJSAction(const CFX_ByteString& csName) const {
319 ASSERT(m_pDocument); 288 ASSERT(m_pDocument);
320 CPDF_NameTree name_tree(m_pDocument, "JavaScript"); 289 CPDF_NameTree name_tree(m_pDocument, "JavaScript");
321 return name_tree.GetIndex(csName); 290 return name_tree.GetIndex(csName);
322 } 291 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp ('k') | core/src/fpdfdoc/doc_formcontrol.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698