1 #include "ArticleCollection.h"
3 ArticleCollection::~ArticleCollection()
5 /* this is still kinda ugly, since other pointers may exist...
6 * also, deleting stack-created articles is going to get ugly
7 * (although you shouldn't have pointers to stack variables
9 for(auto it
= articleSet
.rbegin(); it
!= articleSet
.rend(); it
++) {
10 /* reverse iteration, forward one could cause us trouble if we
17 Article
* ArticleCollection::get(std::string title
)
19 auto it
= articleSet
.find(title
);
21 if(articleSet
.end() == it
) {
27 bool ArticleCollection::add(Article
* article
)
29 auto ret
= articleSet
.insert(std::make_pair(article
->getTitle(), article
));
33 ArticleCollection::iterator
ArticleCollection::begin()
35 return articleSet
.begin();
38 ArticleCollection::iterator
ArticleCollection::end()
40 return articleSet
.end();
43 ArticleCollection::const_iterator
ArticleCollection::begin() const
45 return articleSet
.begin();
48 ArticleCollection::const_iterator
ArticleCollection::end() const
50 return articleSet
.end();