summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-11-12 05:10:07 -0500
committerJohn Wiegley <johnw@newartisans.com>2009-11-12 05:11:09 -0500
commit86daa41a9087007ca507f956ed1dfc47efce9fed (patch)
tree395a3f62c22e3549bec37ff9b1851b4106d723a7 /src
parentcd0a04077867b89e92ba91775c915050abcd620a (diff)
downloadfork-ledger-86daa41a9087007ca507f956ed1dfc47efce9fed.tar.gz
fork-ledger-86daa41a9087007ca507f956ed1dfc47efce9fed.tar.bz2
fork-ledger-86daa41a9087007ca507f956ed1dfc47efce9fed.zip
Added a collect_posts handler
Diffstat (limited to 'src')
-rw-r--r--src/filters.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/filters.h b/src/filters.h
index cc3729ea..80bbe5b4 100644
--- a/src/filters.h
+++ b/src/filters.h
@@ -61,6 +61,35 @@ public:
virtual void operator()(post_t&) {}
};
+class collect_posts : public item_handler<post_t>
+{
+public:
+ std::vector<post_t *> posts;
+
+ collect_posts() : item_handler<post_t>() {
+ TRACE_CTOR(collect_posts, "");
+ }
+ virtual ~collect_posts() {
+ TRACE_DTOR(collect_posts);
+ }
+
+ std::size_t length() const {
+ return posts.size();
+ }
+
+ std::vector<post_t *>::iterator begin() {
+ return posts.begin();
+ }
+ std::vector<post_t *>::iterator end() {
+ return posts.end();
+ }
+
+ virtual void flush() {}
+ virtual void operator()(post_t& post) {
+ posts.push_back(&post);
+ }
+};
+
class posts_iterator;
class pass_down_posts : public item_handler<post_t>