From 161d6f79bd6f4ab45afa1cbae77548c8e508809a Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 26 Jul 2004 23:33:51 -0400 Subject: initial rev of 2.0 --- item.h | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 item.h (limited to 'item.h') diff --git a/item.h b/item.h new file mode 100644 index 00000000..f14e7f8e --- /dev/null +++ b/item.h @@ -0,0 +1,57 @@ +#ifndef _REPORT_H +#define _REPORT_H + +#include "ledger.h" +#include "balance.h" + +#include + +namespace ledger { + +struct node_t; +struct item_t; +typedef std::deque items_deque; + +struct item_t +{ + struct item_t * parent; + unsigned int index; + std::time_t date; + std::string payee; + const account_t * account; + balance_pair_t value; + balance_pair_t total; + + items_deque subitems; + + item_t() : parent(NULL), index(0), date(-1), account(NULL) {} + + ~item_t() { + for (items_deque::iterator i = subitems.begin(); + i != subitems.end(); + i++) + delete *i; + } + + void sort(const node_t * sort_order); +}; + +class constraints_t; + +item_t * walk_accounts(const account_t * account, + const constraints_t& constraints, + const bool compute_subtotals); + +item_t * walk_items(const item_t * top, + const account_t * account, + const constraints_t& constraints, + const bool compute_subtotals); + +item_t * walk_entries(entries_list::const_iterator begin, + entries_list::const_iterator end, + const constraints_t& constraints, + const format_t& format); + +} // namespace report + +#endif // _REPORT_H -- cgit v1.2.3