diff options
author | John Wiegley <johnw@newartisans.com> | 2013-04-29 16:36:29 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2013-04-29 16:36:29 -0500 |
commit | 59550b7f66c31592160749c5177074f63d19fa9d (patch) | |
tree | 0b28be9ab403e67d042f74ae9d1d76d885486b18 /src/output.cc | |
parent | 385cbd25b9905b16a4c7723bb4e5a5813e84aab0 (diff) | |
parent | 6bef247759acbdc026624e78d0fd78297bc79501 (diff) | |
download | fork-ledger-59550b7f66c31592160749c5177074f63d19fa9d.tar.gz fork-ledger-59550b7f66c31592160749c5177074f63d19fa9d.tar.bz2 fork-ledger-59550b7f66c31592160749c5177074f63d19fa9d.zip |
Merge branch 'next'
Diffstat (limited to 'src/output.cc')
-rw-r--r-- | src/output.cc | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/output.cc b/src/output.cc index f433f8d1..77d28eed 100644 --- a/src/output.cc +++ b/src/output.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2012, John Wiegley. All rights reserved. + * Copyright (c) 2003-2013, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -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); |