diff options
-rw-r--r-- | src/filters.h | 29 |
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> |