summaryrefslogtreecommitdiffstats
path: root/src/Dictionary.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Dictionary.cpp')
-rw-r--r--src/Dictionary.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Dictionary.cpp b/src/Dictionary.cpp
index 79f0afc..a9f85ea 100644
--- a/src/Dictionary.cpp
+++ b/src/Dictionary.cpp
@@ -229,7 +229,12 @@ Dictionary::iterator Dictionary::End()
229 return _map.end(); 229 return _map.end();
230} 230}
231 231
232void Dictionary::Insert(const std::string& key, Node* node) 232Dictionary::iterator Dictionary::Find(const std::string& key)
233{
234 return _map.find(key);
235}
236
237Dictionary::iterator Dictionary::Insert(const std::string& key, Node* node)
233{ 238{
234 if (node) 239 if (node)
235 { 240 {
@@ -237,7 +242,9 @@ void Dictionary::Insert(const std::string& key, Node* node)
237 plist_dict_insert_item(_node, key.c_str(), clone->GetPlist()); 242 plist_dict_insert_item(_node, key.c_str(), clone->GetPlist());
238 delete _map[key]; 243 delete _map[key];
239 _map[key] = clone; 244 _map[key] = clone;
245 return _map.find(key);
240 } 246 }
247 return iterator(NULL);
241} 248}
242 249
243void Dictionary::Remove(Node* node) 250void Dictionary::Remove(Node* node)
@@ -249,6 +256,7 @@ void Dictionary::Remove(Node* node)
249 plist_dict_remove_item(_node, key); 256 plist_dict_remove_item(_node, key);
250 std::string skey = key; 257 std::string skey = key;
251 free(key); 258 free(key);
259 _map.erase(skey);
252 delete node; 260 delete node;
253 } 261 }
254} 262}
@@ -257,6 +265,7 @@ void Dictionary::Remove(const std::string& key)
257{ 265{
258 plist_dict_remove_item(_node, key.c_str()); 266 plist_dict_remove_item(_node, key.c_str());
259 delete _map[key]; 267 delete _map[key];
268 _map.erase(key);
260} 269}
261 270
262}; 271};