From 487ea6a2171ec70b8ee0ff147a44abb6d89679dc Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 30 Sep 2003 20:18:52 +0000 Subject: *** empty log message *** --- ledger.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'ledger.h') diff --git a/ledger.h b/ledger.h index d189d526..ec82f54a 100644 --- a/ledger.h +++ b/ledger.h @@ -1,5 +1,5 @@ #ifndef _LEDGER_H -#define _LEDGER_H "$Revision: 1.6 $" +#define _LEDGER_H "$Revision: 1.7 $" ////////////////////////////////////////////////////////////////////// // @@ -245,10 +245,11 @@ operator<<(std::basic_ostream& out, const totals& t) { struct account { + struct account * parent; + std::string name; commodity * comm; // default commodity for this account - - struct account * parent; + totals balance; typedef std::map map; typedef map::iterator iterator; @@ -258,20 +259,20 @@ struct account map children; account(const std::string& _name, struct account * _parent = NULL) - : name(_name), parent(_parent) {} + : parent(_parent), name(_name) {} - operator std::string() const { + const std::string as_str() const { if (! parent) return name; else - return std::string(*parent) + ":" + name; + return parent->as_str() + ":" + name; } }; template std::basic_ostream & operator<<(std::basic_ostream& out, const account& a) { - return (out << std::string(a)); + return (out << a.as_str()); } -- cgit v1.2.3