summaryrefslogtreecommitdiff
path: root/ledger.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2003-09-30 20:18:52 +0000
committerJohn Wiegley <johnw@newartisans.com>2003-09-30 20:18:52 +0000
commit487ea6a2171ec70b8ee0ff147a44abb6d89679dc (patch)
treea13fbc20b475c75fafe345b0bb29dd266c866b35 /ledger.h
parentf6c2e3d51eb8cd0892e5beeae59b74f12d14c027 (diff)
downloadfork-ledger-487ea6a2171ec70b8ee0ff147a44abb6d89679dc.tar.gz
fork-ledger-487ea6a2171ec70b8ee0ff147a44abb6d89679dc.tar.bz2
fork-ledger-487ea6a2171ec70b8ee0ff147a44abb6d89679dc.zip
*** empty log message ***
Diffstat (limited to 'ledger.h')
-rw-r--r--ledger.h15
1 files changed, 8 insertions, 7 deletions
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<char, Traits>& 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<const std::string, struct account *> 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<class Traits>
std::basic_ostream<char, Traits> &
operator<<(std::basic_ostream<char, Traits>& out, const account& a) {
- return (out << std::string(a));
+ return (out << a.as_str());
}