From ccd6f05fe1e6cd5a1611b0df78974fa39869013d Mon Sep 17 00:00:00 2001 From: Aaron Burghardt Date: Fri, 15 Aug 2014 21:59:01 -0400 Subject: Change Clone() to be const, which required constructors with const references and a const GetValue(). --- src/Dictionary.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/Dictionary.cpp') diff --git a/src/Dictionary.cpp b/src/Dictionary.cpp index 6009ea4..98eeb93 100644 --- a/src/Dictionary.cpp +++ b/src/Dictionary.cpp @@ -49,7 +49,7 @@ Dictionary::Dictionary(plist_t node, Node* parent) : Structure(parent) free(it); } -Dictionary::Dictionary(PList::Dictionary& d) : Structure() +Dictionary::Dictionary(const PList::Dictionary& d) : Structure() { for (Dictionary::iterator it = _map.begin(); it != _map.end(); it++) { @@ -115,7 +115,7 @@ Dictionary::~Dictionary() _map.clear(); } -Node* Dictionary::Clone() +Node* Dictionary::Clone() const { return new Dictionary(*this); } @@ -140,7 +140,7 @@ Dictionary::iterator Dictionary::Find(const std::string& key) return _map.find(key); } -Dictionary::iterator Dictionary::Set(const std::string& key, Node* node) +Dictionary::iterator Dictionary::Set(const std::string& key, const Node* node) { if (node) { @@ -154,6 +154,11 @@ Dictionary::iterator Dictionary::Set(const std::string& key, Node* node) return iterator(this->_map.end()); } +Dictionary::iterator Dictionary::Set(const std::string& key, const Node& node) +{ + return Set(key, &node); +} + Dictionary::iterator Dictionary::Insert(const std::string& key, Node* node) { return this->Set(key, node); -- cgit v1.1-32-gdbae