summaryrefslogtreecommitdiff
path: root/src/output.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-03-07 22:47:07 -0500
committerJohn Wiegley <johnw@newartisans.com>2010-03-08 01:11:48 -0500
commit75b7294a6db10e7f7b18b6aeef1aa0f568124a1d (patch)
tree0fecbc12acaacb33cf3c241c536de3347d2742ed /src/output.cc
parent7e79cd82cd4ad5f87f40e6beebdb53e65bb11168 (diff)
downloadfork-ledger-75b7294a6db10e7f7b18b6aeef1aa0f568124a1d.tar.gz
fork-ledger-75b7294a6db10e7f7b18b6aeef1aa0f568124a1d.tar.bz2
fork-ledger-75b7294a6db10e7f7b18b6aeef1aa0f568124a1d.zip
Rewrite the "print" command as a custom function
There ended up being too many corner cases for the generalized formatter to handle.
Diffstat (limited to 'src/output.cc')
-rw-r--r--src/output.cc24
1 files changed, 3 insertions, 21 deletions
diff --git a/src/output.cc b/src/output.cc
index c3afc9bc..30775310 100644
--- a/src/output.cc
+++ b/src/output.cc
@@ -42,10 +42,8 @@ namespace ledger {
format_posts::format_posts(report_t& _report,
const string& format,
- bool _print_raw,
const optional<string>& _prepend_format)
- : report(_report), last_xact(NULL), last_post(NULL),
- print_raw(_print_raw)
+ : report(_report), last_xact(NULL), last_post(NULL)
{
TRACE_CTOR(format_posts, "report&, const string&, bool");
@@ -80,24 +78,8 @@ void format_posts::operator()(post_t& post)
{
std::ostream& out(report.output_stream);
- if (print_raw) {
- if (! post.has_xdata() ||
- ! post.xdata().has_flags(POST_EXT_DISPLAYED)) {
- if (last_xact != post.xact) {
- if (last_xact) {
- bind_scope_t xact_scope(report, *last_xact);
- out << between_format(xact_scope);
- }
- print_item(out, *post.xact);
- out << '\n';
- last_xact = post.xact;
- }
- post.xdata().add_flags(POST_EXT_DISPLAYED);
- last_post = &post;
- }
- }
- else if (! post.has_xdata() ||
- ! post.xdata().has_flags(POST_EXT_DISPLAYED)) {
+ if (! post.has_xdata() ||
+ ! post.xdata().has_flags(POST_EXT_DISPLAYED)) {
bind_scope_t bound_scope(report, post);
if (prepend_format)