summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc/doc_action.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-11-09 22:41:21 -0800
committerLei Zhang <thestig@chromium.org>2015-11-09 22:41:21 -0800
commit8deeacd23872ecc132a0a678e344a018b5114a3a (patch)
treeeba48ec898f8b6454f4e29caa4bf0a6f75519056 /core/src/fpdfdoc/doc_action.cpp
parent6d9979dc685e3b67b0a6d9946376e026d75d3e47 (diff)
downloadpdfium-8deeacd23872ecc132a0a678e344a018b5114a3a.tar.xz
Remove CFX_PtrArray usage in fpdfsdk.
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1430213002 .
Diffstat (limited to 'core/src/fpdfdoc/doc_action.cpp')
-rw-r--r--core/src/fpdfdoc/doc_action.cpp42
1 files changed, 22 insertions, 20 deletions
diff --git a/core/src/fpdfdoc/doc_action.cpp b/core/src/fpdfdoc/doc_action.cpp
index d685f64cae..3d439ff570 100644
--- a/core/src/fpdfdoc/doc_action.cpp
+++ b/core/src/fpdfdoc/doc_action.cpp
@@ -111,37 +111,39 @@ FX_DWORD CPDF_ActionFields::GetFieldsCount() const {
return pArray->GetCount();
return 0;
}
-void CPDF_ActionFields::GetAllFields(CFX_PtrArray& fieldObjects) const {
- fieldObjects.RemoveAll();
- if (m_pAction == NULL) {
- return;
- }
+
+std::vector<CPDF_Object*> CPDF_ActionFields::GetAllFields() const {
+ std::vector<CPDF_Object*> fields;
+ if (!m_pAction)
+ return fields;
+
CPDF_Dictionary* pDict = m_pAction->GetDict();
- if (pDict == NULL) {
- return;
- }
+ if (!pDict)
+ return fields;
+
CFX_ByteString csType = pDict->GetString("S");
- CPDF_Object* pFields = NULL;
- if (csType == "Hide") {
+ CPDF_Object* pFields;
+ if (csType == "Hide")
pFields = pDict->GetElementValue("T");
- } else {
+ else
pFields = pDict->GetArray("Fields");
- }
if (!pFields)
- return;
+ return fields;
if (pFields->IsDictionary() || pFields->IsString()) {
- fieldObjects.Add(pFields);
+ fields.push_back(pFields);
} else if (CPDF_Array* pArray = pFields->AsArray()) {
FX_DWORD iCount = pArray->GetCount();
- for (FX_DWORD i = 0; i < iCount; i++) {
+ for (FX_DWORD i = 0; i < iCount; ++i) {
CPDF_Object* pObj = pArray->GetElementValue(i);
- if (pObj != NULL) {
- fieldObjects.Add(pObj);
+ if (pObj) {
+ fields.push_back(pObj);
}
}
}
+ return fields;
}
+
CPDF_Object* CPDF_ActionFields::GetField(FX_DWORD iIndex) const {
if (m_pAction == NULL) {
return NULL;
@@ -291,9 +293,9 @@ CPDF_Action CPDF_AAction::GetNextAction(FX_POSITION& pos,
eType = (AActionType)i;
return CPDF_Action(pDict);
}
-CPDF_DocJSActions::CPDF_DocJSActions(CPDF_Document* pDoc) {
- m_pDocument = pDoc;
-}
+
+CPDF_DocJSActions::CPDF_DocJSActions(CPDF_Document* pDoc) : m_pDocument(pDoc) {}
+
int CPDF_DocJSActions::CountJSActions() const {
ASSERT(m_pDocument != NULL);
CPDF_NameTree name_tree(m_pDocument, FX_BSTRC("JavaScript"));