summaryrefslogtreecommitdiff
path: root/item.h
diff options
context:
space:
mode:
Diffstat (limited to 'item.h')
-rw-r--r--item.h57
1 files changed, 57 insertions, 0 deletions
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 <deque>
+
+namespace ledger {
+
+struct node_t;
+struct item_t;
+typedef std::deque<item_t *> 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