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

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

Issue 1541703003: Use std::map as CPDF_Dictionary's underlying store. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: XFA still uses CFX_CMapByteStringToPtr :( Created 5 years 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
Index: core/include/fpdfapi/fpdf_objects.h
diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h
index e80801c507427e327b3bef9985280c9f6f29720e..0a4e08e7870ebb40c4068df9273fb90d760fb5eb 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"
@@ -338,6 +339,9 @@ inline const CPDF_Array* ToArray(const CPDF_Object* obj) {
class CPDF_Dictionary : public CPDF_Object {
public:
+ typedef std::map<CFX_ByteString, CPDF_Object*>::iterator iterator;
Tom Sepez 2016/01/05 19:41:55 nit: using
Oliver Chang 2016/01/07 16:04:25 Done.
+ typedef std::map<CFX_ByteString, CPDF_Object*>::const_iterator const_iterator;
+
CPDF_Dictionary() : CPDF_Object(PDFOBJ_DICTIONARY) {}
CPDF_Object* GetElement(const CFX_ByteStringC& key) const;
@@ -380,10 +384,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);
@@ -420,14 +420,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') | core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698