diff options
author | John Wiegley <johnw@newartisans.com> | 2004-07-27 01:33:41 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2004-07-27 01:33:41 -0400 |
commit | dd5680c2674fe9ce458941ec9b3978cd7dda9bff (patch) | |
tree | 6f54757768b36ef3ab9590d490f1c96e4b798c11 /format.h | |
parent | 161d6f79bd6f4ab45afa1cbae77548c8e508809a (diff) | |
download | fork-ledger-dd5680c2674fe9ce458941ec9b3978cd7dda9bff.tar.gz fork-ledger-dd5680c2674fe9ce458941ec9b3978cd7dda9bff.tar.bz2 fork-ledger-dd5680c2674fe9ce458941ec9b3978cd7dda9bff.zip |
reorganized report.cc into item.cc, expr.cc and format.cc
Diffstat (limited to 'format.h')
-rw-r--r-- | format.h | 33 |
1 files changed, 25 insertions, 8 deletions
@@ -1,9 +1,10 @@ -#ifndef _REPORT_H -#define _REPORT_H +#ifndef _FORMAT_H +#define _FORMAT_H #include "ledger.h" -#include "constraint.h" #include "balance.h" +#include "constraint.h" +#include "expr.h" namespace ledger { @@ -12,8 +13,6 @@ std::string maximal_account_name(const item_t * item, const item_t * parent); struct format_t { - constraints_t constraints; - std::string format_string; node_t * value_style; node_t * total_style; @@ -28,22 +27,40 @@ struct format_t if (total_style) delete total_style; } +#if 1 balance_t compute_value(const item_t * item) const { if (value_style) - return value_style->compute(begin(), end(), item); + return value_style->compute(item); else return balance_t(); } balance_t compute_total(const item_t * item) const { if (total_style) - return total_style->compute(begin(), end(), item); + return total_style->compute(item); + else + return balance_t(); + } +#else + balance_t compute_value(const item_t * item, + const constraints_t& constraints) const { + if (value_style) + return value_style->compute(item, constraints.begin(), constraints.end()); + else + return balance_t(); + } + + balance_t compute_total(const item_t * item, + const constraints_t& constraints) const { + if (total_style) + return total_style->compute(item, constraints.begin(), constraints.end()); else return balance_t(); } +#endif std::string report_line(const item_t * item, - const item_t * displayed_parent = NULL); + const item_t * displayed_parent = NULL) const; }; } // namespace ledger |