diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-21 19:45:13 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-21 19:45:13 -0400 |
commit | a577e8c48ebe3b540a6833e1d37025d53c8a42a7 (patch) | |
tree | 5c6ba4c5ab8200cd4187892189af90594c962bd9 /src/output.cc | |
parent | dc63429785fb677f5997a84ee7dd1dbc03f1e127 (diff) | |
download | fork-ledger-a577e8c48ebe3b540a6833e1d37025d53c8a42a7.tar.gz fork-ledger-a577e8c48ebe3b540a6833e1d37025d53c8a42a7.tar.bz2 fork-ledger-a577e8c48ebe3b540a6833e1d37025d53c8a42a7.zip |
Added a new --raw option, for use with print
Diffstat (limited to 'src/output.cc')
-rw-r--r-- | src/output.cc | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/src/output.cc b/src/output.cc index d1214c33..fd27e2bb 100644 --- a/src/output.cc +++ b/src/output.cc @@ -33,8 +33,11 @@ namespace ledger { -format_xacts::format_xacts(report_t& _report, const string& format) - : report(_report), last_entry(NULL), last_xact(NULL) +format_xacts::format_xacts(report_t& _report, + const string& format, + bool _print_raw) + : report(_report), last_entry(NULL), last_xact(NULL), + print_raw(_print_raw) { TRACE_CTOR(format_xacts, "report&, const string&"); @@ -59,23 +62,37 @@ void format_xacts::operator()(xact_t& xact) { std::ostream& out(report.output_stream); - if (! xact.has_xdata() || - ! xact.xdata().has_flags(XACT_EXT_DISPLAYED)) { + if (print_raw) { + if (! xact.has_xdata() || + ! xact.xdata().has_flags(XACT_EXT_DISPLAYED)) { + if (last_entry != xact.entry) { + if (last_entry) { + bind_scope_t entry_scope(report, *last_entry); + between_format.format(out, entry_scope); + } + print_item(out, *xact.entry); + out << '\n'; + last_entry = xact.entry; + } + xact.xdata().add_flags(XACT_EXT_DISPLAYED); + last_xact = &xact; + } + } + else if (! xact.has_xdata() || + ! xact.xdata().has_flags(XACT_EXT_DISPLAYED)) { + bind_scope_t bound_scope(report, xact); if (last_entry != xact.entry) { if (last_entry) { - bind_scope_t bound_scope(report, *last_entry); - between_format.format(out, bound_scope); + bind_scope_t entry_scope(report, *last_entry); + between_format.format(out, entry_scope); } - bind_scope_t bound_scope(report, xact); first_line_format.format(out, bound_scope); last_entry = xact.entry; } else if (last_xact && last_xact->date() != xact.date()) { - bind_scope_t bound_scope(report, xact); first_line_format.format(out, bound_scope); } else { - bind_scope_t bound_scope(report, xact); next_lines_format.format(out, bound_scope); } |