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

Unified Diff: core/include/fpdfapi/fpdf_objects.h

Issue 1576033002: Merge to XFA: Use std::map as CPDF_Dictionary's underlying store. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | core/include/fpdfdoc/fpdf_doc.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/include/fpdfapi/fpdf_objects.h
diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h
index a9a27c74a1235b83488a9adb0dd0c0273a76072f..5e17685e65e3cfd08a8b1e9caddec8b4d0e94934 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;
};
« no previous file with comments | « no previous file | core/include/fpdfdoc/fpdf_doc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698