Add doxygen file commands to headers and sources
[dueringa_WikiWalker.git] / src / ArticleCollection.cpp
blob166a6adab730ed9a2725b5cccc85d8a2911b3157
1 //! \file ArticleCollection.cpp
3 #include "ArticleCollection.h"
5 ArticleCollection::~ArticleCollection()
7 /* this is still kinda ugly, since other pointers may exist...
8 * also, deleting stack-created articles is going to get ugly
9 * (although you shouldn't have pointers to stack variables
10 * anyway... */
11 for(auto it = articleSet.rbegin(); it != articleSet.rend(); it++) {
12 /* reverse iteration, forward one could cause us trouble if we
13 * delete and erase */
14 delete it->second;
16 articleSet.clear();
19 Article* ArticleCollection::get(std::string title)
21 auto it = articleSet.find(title);
23 if(articleSet.end() == it) {
24 return nullptr;
27 return it->second;
29 bool ArticleCollection::add(Article* article)
31 auto ret = articleSet.insert(std::make_pair(article->getTitle(), article));
32 return ret.second;
35 ArticleCollection::iterator ArticleCollection::begin()
37 return articleSet.begin();
40 ArticleCollection::iterator ArticleCollection::end()
42 return articleSet.end();
45 ArticleCollection::const_iterator ArticleCollection::begin() const
47 return articleSet.begin();
50 ArticleCollection::const_iterator ArticleCollection::end() const
52 return articleSet.end();