diff options
author | John Wiegley <johnw@newartisans.com> | 2010-05-22 15:40:38 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-05-22 21:35:02 -0400 |
commit | de3803d0277353520116f05c7b2357196a8cfe48 (patch) | |
tree | 4648465cf73f1879d3d191924bdf905f96148924 /src/output.h | |
parent | e3ba0117a39a3665743df5a1d5ca3b77ca2f00ec (diff) | |
download | fork-ledger-de3803d0277353520116f05c7b2357196a8cfe48.tar.gz fork-ledger-de3803d0277353520116f05c7b2357196a8cfe48.tar.bz2 fork-ledger-de3803d0277353520116f05c7b2357196a8cfe48.zip |
Added new commands: acounts, payees, commodities
These three reports simply dump an unordered list (with the exception of
payees) shows all accounts, payees, and commodities represented in a
given report. This can be used to easily generate per-entity report,
for example:
ledger payees | \
while read payee; do \
echo ; echo $payee ; \
ledger reg payee "$payee" ; \
done
Diffstat (limited to 'src/output.h')
-rw-r--r-- | src/output.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/output.h b/src/output.h index 7618e567..3e70d9fe 100644 --- a/src/output.h +++ b/src/output.h @@ -103,6 +103,69 @@ public: virtual void operator()(account_t& account); }; +class report_accounts : public item_handler<post_t> +{ +protected: + report_t& report; + + std::map<account_t *, bool> accounts; + + typedef std::map<account_t *, bool>::value_type accounts_pair; + +public: + report_accounts(report_t& _report) : report(_report) { + TRACE_CTOR(report_accounts, "report&"); + } + virtual ~report_accounts() { + TRACE_DTOR(report_accounts); + } + + virtual void flush(); + virtual void operator()(post_t& post); +}; + +class report_payees : public item_handler<post_t> +{ +protected: + report_t& report; + + std::map<string, bool> payees; + + typedef std::map<string, bool>::value_type payees_pair; + +public: + report_payees(report_t& _report) : report(_report) { + TRACE_CTOR(report_payees, "report&"); + } + virtual ~report_payees() { + TRACE_DTOR(report_payees); + } + + virtual void flush(); + virtual void operator()(post_t& post); +}; + +class report_commodities : public item_handler<post_t> +{ +protected: + report_t& report; + + std::map<commodity_t *, bool> commodities; + + typedef std::map<commodity_t *, bool>::value_type commodities_pair; + +public: + report_commodities(report_t& _report) : report(_report) { + TRACE_CTOR(report_commodities, "report&"); + } + virtual ~report_commodities() { + TRACE_DTOR(report_commodities); + } + + virtual void flush(); + virtual void operator()(post_t& post); +}; + } // namespace ledger #endif // _OUTPUT_H |