summaryrefslogtreecommitdiff
path: root/ledger.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2004-06-30 02:09:42 -0400
committerjohnw <johnw@newartisans.com>2004-06-30 02:09:42 -0400
commitf9c4f85870a03722953e950ef27f01a44a911c4d (patch)
treea91816410bbbc746df5eef6f88ca118f0aa7dda1 /ledger.cc
parent1a5390243edf87b21e7bba0568150d50e3f10d5a (diff)
downloadfork-ledger-f9c4f85870a03722953e950ef27f01a44a911c4d.tar.gz
fork-ledger-f9c4f85870a03722953e950ef27f01a44a911c4d.tar.bz2
fork-ledger-f9c4f85870a03722953e950ef27f01a44a911c4d.zip
fixes
Diffstat (limited to 'ledger.cc')
-rw-r--r--ledger.cc26
1 files changed, 21 insertions, 5 deletions
diff --git a/ledger.cc b/ledger.cc
index 5f5326a4..4985fba6 100644
--- a/ledger.cc
+++ b/ledger.cc
@@ -447,21 +447,37 @@ void totals::print(std::ostream& out, int width) const
}
}
-void totals::print_street(std::ostream& out, int width, std::time_t * when,
- bool use_history, bool download) const
+totals * totals::value() const
+{
+ totals * cost_basis = new totals;
+
+ for (const_iterator i = amounts.begin(); i != amounts.end(); i++) {
+ if ((*i).second->is_zero())
+ continue;
+
+ amount * value = (*i).second->value();
+ cost_basis->credit(value);
+ delete value;
+ }
+
+ return cost_basis;
+}
+
+totals * totals::street(std::time_t * when, bool use_history,
+ bool download) const
{
- totals street_balance;
+ totals * street_balance = new totals;
for (const_iterator i = amounts.begin(); i != amounts.end(); i++) {
if ((*i).second->is_zero())
continue;
amount * street = (*i).second->street(when, use_history, download);
- street_balance.credit(street);
+ street_balance->credit(street);
delete street;
}
- street_balance.print(out, width);
+ return street_balance;
}
account::~account()