summaryrefslogtreecommitdiff
path: root/src/output.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/output.cc')
-rw-r--r--src/output.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/output.cc b/src/output.cc
index f433f8d1..6ed7f861 100644
--- a/src/output.cc
+++ b/src/output.cc
@@ -318,6 +318,34 @@ void report_payees::operator()(post_t& post)
(*i).second++;
}
+void report_tags::flush()
+{
+ std::ostream& out(report.output_stream);
+
+ foreach (tags_pair& entry, tags) {
+ if (report.HANDLED(count))
+ out << entry.second << ' ';
+ out << entry.first << '\n';
+ }
+}
+
+void report_tags::operator()(post_t& post)
+{
+ if(post.metadata){
+ foreach (const item_t::string_map::value_type& data, *post.metadata){
+ string tag=data.first;
+ if(report.HANDLED(values) && (data.second).first){
+ tag+=": "+ (data.second).first.get().to_string();
+ }
+ std::map<string, std::size_t>::iterator i = tags.find(tag);
+ if (i == tags.end())
+ tags.insert(tags_pair(tag, 1));
+ else
+ (*i).second++;
+ }
+ }
+}
+
void report_commodities::flush()
{
std::ostream& out(report.output_stream);