diff options
author | Oliver Chang <ochang@chromium.org> | 2016-01-11 08:45:31 -0800 |
---|---|---|
committer | Oliver Chang <ochang@chromium.org> | 2016-01-11 08:45:31 -0800 |
commit | 3f1c71f5a6ea058e3eec611c9dcc759b374dcb80 (patch) | |
tree | b4ef8de26360979381c441cbdfaba94e493b09f6 /core/src/fpdfdoc/doc_formcontrol.cpp | |
parent | c909ce872d999a17ffd44afdc88caf2de43e6cba (diff) | |
download | pdfium-3f1c71f5a6ea058e3eec611c9dcc759b374dcb80.tar.xz |
Merge to XFA: Use std::map as CPDF_Dictionary's underlying store.
Replaces CFX_CMapByteStringToPtr. XFA still uses CFX_CMapByteStringToPtr
so it's not completely removed just yet.
Adds begin()/end() to CPDF_Dictionary and removes the
GetStartPos()/GetNextElement() functions to traverse the dictionary.
Callers are changed accordingly. AddValue() is also removed.
TBR=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1541703003 .
(cherry picked from commit 14f39950451bb9c2a11fbc7173fd47367410f80f)
Review URL: https://codereview.chromium.org/1576033002 .
Diffstat (limited to 'core/src/fpdfdoc/doc_formcontrol.cpp')
-rw-r--r-- | core/src/fpdfdoc/doc_formcontrol.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/core/src/fpdfdoc/doc_formcontrol.cpp b/core/src/fpdfdoc/doc_formcontrol.cpp index 93e837feaf..bd339e375c 100644 --- a/core/src/fpdfdoc/doc_formcontrol.cpp +++ b/core/src/fpdfdoc/doc_formcontrol.cpp @@ -27,11 +27,9 @@ CFX_ByteString CPDF_FormControl::GetOnStateName() { if (!pN) { return csOn; } - FX_POSITION pos = pN->GetStartPos(); - while (pos) { - pN->GetNextElement(pos, csOn); - if (csOn != "Off") { - return csOn; + for (const auto& it : *pN) { + if (it.first != "Off") { + return it.first; } } return CFX_ByteString(); @@ -54,10 +52,8 @@ void CPDF_FormControl::SetOnStateName(const CFX_ByteString& csOn) { if (!pAP) { return; } - FX_POSITION pos1 = pAP->GetStartPos(); - while (pos1) { - CFX_ByteString csKey1; - CPDF_Object* pObj1 = pAP->GetNextElement(pos1, csKey1); + for (const auto& it : *pAP) { + CPDF_Object* pObj1 = it.second; if (!pObj1) { continue; } @@ -66,10 +62,9 @@ void CPDF_FormControl::SetOnStateName(const CFX_ByteString& csOn) { if (!pSubDict) continue; - FX_POSITION pos2 = pSubDict->GetStartPos(); - while (pos2) { - CFX_ByteString csKey2; - CPDF_Object* pObj2 = pSubDict->GetNextElement(pos2, csKey2); + for (const auto& subdict_it : *pSubDict) { + const CFX_ByteString& csKey2 = subdict_it.first; + CPDF_Object* pObj2 = subdict_it.second; if (!pObj2) { continue; } |