1 //! \file ArticleCollection.cpp
3 #include "ArticleCollection.h"
7 ArticleCollection::~ArticleCollection()
9 /* this is still kinda ugly, since other pointers may exist...
10 * also, deleting stack-created articles is going to get ugly
11 * (although you shouldn't have pointers to stack variables
13 for(auto it
= articleSet
.rbegin(); it
!= articleSet
.rend(); it
++) {
14 /* reverse iteration, forward one could cause us trouble if we
21 Article
* ArticleCollection::get(std::string title
)
23 auto it
= articleSet
.find(title
);
25 if(articleSet
.end() == it
) {
31 bool ArticleCollection::add(Article
* article
)
33 auto ret
= articleSet
.insert(std::make_pair(article
->getTitle(), article
));
37 ArticleCollection::iterator
ArticleCollection::begin()
39 return articleSet
.begin();
42 ArticleCollection::iterator
ArticleCollection::end()
44 return articleSet
.end();
47 ArticleCollection::const_iterator
ArticleCollection::begin() const
49 return articleSet
.begin();
52 ArticleCollection::const_iterator
ArticleCollection::end() const
54 return articleSet
.end();