summaryrefslogtreecommitdiff
path: root/core/include
diff options
context:
space:
mode:
authorOliver Chang <ochang@chromium.org>2016-01-11 08:45:31 -0800
committerOliver Chang <ochang@chromium.org>2016-01-11 08:45:31 -0800
commit3f1c71f5a6ea058e3eec611c9dcc759b374dcb80 (patch)
treeb4ef8de26360979381c441cbdfaba94e493b09f6 /core/include
parentc909ce872d999a17ffd44afdc88caf2de43e6cba (diff)
downloadpdfium-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/include')
-rw-r--r--core/include/fpdfapi/fpdf_objects.h20
-rw-r--r--core/include/fpdfdoc/fpdf_doc.h4
2 files changed, 13 insertions, 11 deletions
diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h
index a9a27c74a1..5e17685e65 100644
--- a/core/include/fpdfapi/fpdf_objects.h
+++ b/core/include/fpdfapi/fpdf_objects.h
@@ -7,6 +7,7 @@
#ifndef CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_
#define CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_
+#include <map>
#include <set>
#include "core/include/fxcrt/fx_coordinates.h"
@@ -339,6 +340,9 @@ inline const CPDF_Array* ToArray(const CPDF_Object* obj) {
class CPDF_Dictionary : public CPDF_Object {
public:
+ using iterator = std::map<CFX_ByteString, CPDF_Object*>::iterator;
+ using const_iterator = std::map<CFX_ByteString, CPDF_Object*>::const_iterator;
+
CPDF_Dictionary() : CPDF_Object(PDFOBJ_DICTIONARY) {}
CPDF_Object* GetElement(const CFX_ByteStringC& key) const;
@@ -381,10 +385,6 @@ class CPDF_Dictionary : public CPDF_Object {
FX_BOOL KeyExist(const CFX_ByteStringC& key) const;
- FX_POSITION GetStartPos() const;
-
- CPDF_Object* GetNextElement(FX_POSITION& pos, CFX_ByteString& key) const;
-
void SetAt(const CFX_ByteStringC& key, CPDF_Object* pObj);
void SetAtName(const CFX_ByteStringC& key, const CFX_ByteString& name);
@@ -421,14 +421,20 @@ class CPDF_Dictionary : public CPDF_Object {
FX_BOOL Identical(CPDF_Dictionary* pDict) const;
- int GetCount() const { return m_Map.GetCount(); }
+ size_t GetCount() const { return m_Map.size(); }
+
+ iterator begin() { return m_Map.begin(); }
+
+ iterator end() { return m_Map.end(); }
+
+ const_iterator begin() const { return m_Map.begin(); }
- void AddValue(const CFX_ByteStringC& key, CPDF_Object* pObj);
+ const_iterator end() const { return m_Map.end(); }
protected:
~CPDF_Dictionary();
- CFX_CMapByteStringToPtr m_Map;
+ std::map<CFX_ByteString, CPDF_Object*> m_Map;
friend class CPDF_Object;
};
diff --git a/core/include/fpdfdoc/fpdf_doc.h b/core/include/fpdfdoc/fpdf_doc.h
index ce05588f54..7a6dd4fcd4 100644
--- a/core/include/fpdfdoc/fpdf_doc.h
+++ b/core/include/fpdfdoc/fpdf_doc.h
@@ -298,10 +298,6 @@ class CPDF_AAction {
CPDF_Action GetAction(AActionType eType) const;
- FX_POSITION GetStartPos() const;
-
- CPDF_Action GetNextAction(FX_POSITION& pos, AActionType& eType) const;
-
CPDF_Dictionary* m_pDict;
};
class CPDF_DocJSActions {