]> git.tdb.fi Git - libs/datafile.git/blob - source/collection.cpp
ea1095b39a93f61e0a14930b8e8edf039da9089e
[libs/datafile.git] / source / collection.cpp
1 /* $Id$
2
3 This file is part of libmspdatafile
4 Copyright © 2006  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #include "collection.h"
9
10 namespace Msp {
11 namespace DataFile {
12
13 Collection::~Collection()
14 {
15         for(ItemMap::iterator i=items.begin(); i!=items.end(); ++i)
16                 delete i->second;
17         for(ItemKeywordSeq::iterator i=keywords.begin(); i!=keywords.end(); ++i)
18                 delete *i;
19         for(ItemCreatorSeq::iterator i=creators.begin(); i!=creators.end(); ++i)
20                 delete *i;
21 }
22
23 bool Collection::contains(const std::string &n) const
24 {
25         return items.count(n);
26 }
27
28
29 Collection::Loader::Loader(Collection &c):
30         coll(c)
31 {       
32         for(ItemKeywordSeq::const_iterator i=coll.keywords.begin(); i!=coll.keywords.end(); ++i)
33                 (*i)->add_to_loader(*this);
34 }
35
36 } // namespace DataFile
37 } // namespace Msp