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
22 Article
* ArticleCollection::get(std::string title
)
24 auto it
= articleSet
.find(title
);
26 if(articleSet
.end() == it
) {
32 bool ArticleCollection::add(Article
* article
)
34 auto ret
= articleSet
.insert(std::make_pair(article
->getTitle(), article
));
38 ArticleCollection::iterator
ArticleCollection::begin()
40 return articleSet
.begin();
43 ArticleCollection::iterator
ArticleCollection::end()
45 return articleSet
.end();
48 ArticleCollection::const_iterator
ArticleCollection::begin() const
50 return articleSet
.begin();
53 ArticleCollection::const_iterator
ArticleCollection::end() const
55 return articleSet
.end();