diff options
-rw-r--r-- | include/plist/Dictionary.h | 4 | ||||
-rw-r--r-- | src/Dictionary.cpp | 15 |
2 files changed, 19 insertions, 0 deletions
diff --git a/include/plist/Dictionary.h b/include/plist/Dictionary.h index 7a29f14..71d40ac 100644 --- a/include/plist/Dictionary.h +++ b/include/plist/Dictionary.h @@ -41,11 +41,15 @@ public : Node* Clone() const; typedef std::map<std::string,Node*>::iterator iterator; + typedef std::map<std::string,Node*>::const_iterator const_iterator; Node* operator[](const std::string& key); iterator Begin(); iterator End(); iterator Find(const std::string& key); + const_iterator Begin() const; + const_iterator End() const; + const_iterator Find(const std::string& key) const; iterator Set(const std::string& key, const Node* node); iterator Set(const std::string& key, const Node& node); iterator Insert(const std::string& key, Node* node) PLIST_WARN_DEPRECATED("use Set() instead"); diff --git a/src/Dictionary.cpp b/src/Dictionary.cpp index 5e2e1c0..59908c6 100644 --- a/src/Dictionary.cpp +++ b/src/Dictionary.cpp @@ -104,11 +104,26 @@ Dictionary::iterator Dictionary::End() return _map.end(); } +Dictionary::const_iterator Dictionary::Begin() const +{ + return _map.begin(); +} + +Dictionary::const_iterator Dictionary::End() const +{ + return _map.end(); +} + Dictionary::iterator Dictionary::Find(const std::string& key) { return _map.find(key); } +Dictionary::const_iterator Dictionary::Find(const std::string& key) const +{ + return _map.find(key); +} + Dictionary::iterator Dictionary::Set(const std::string& key, const Node* node) { if (node) |