comparison Framework/Common/Dictionary.cpp @ 305:87f0e29a1dc1

added Dictionary::Clear()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 12 Jul 2021 09:40:01 +0200
parents 02cd7254c949
children 16aac0287485
comparison
equal deleted inserted replaced
304:dd4b0edd1661 305:87f0e29a1dc1
32 32
33 #include <cassert> 33 #include <cassert>
34 34
35 namespace OrthancDatabases 35 namespace OrthancDatabases
36 { 36 {
37 Dictionary::~Dictionary() 37 void Dictionary::Clear()
38 { 38 {
39 for (Values::iterator it = values_.begin(); 39 for (Values::iterator it = values_.begin();
40 it != values_.end(); ++it) 40 it != values_.end(); ++it)
41 { 41 {
42 assert(it->second != NULL); 42 assert(it->second != NULL);
43 delete it->second; 43 delete it->second;
44 } 44 }
45
46 values_.clear();
45 } 47 }
46 48
47 49
48 bool Dictionary::HasKey(const std::string& key) const 50 bool Dictionary::HasKey(const std::string& key) const
49 { 51 {
50 return values_.find(key) != values_.end(); 52 return values_.find(key) != values_.end();
51 } 53 }