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
11 for(auto it
= articleSet
.rbegin(); it
!= articleSet
.rend(); it
++) {
12 /* reverse iteration, forward one could cause us trouble if we
19 Article
* ArticleCollection::get(std::string title
)
21 auto it
= articleSet
.find(title
);
23 if(articleSet
.end() == it
) {
29 bool ArticleCollection::add(Article
* article
)
31 auto ret
= articleSet
.insert(std::make_pair(article
->getTitle(), article
));
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();