summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--balance.cc15
-rw-r--r--ledger.cc2
-rw-r--r--ledger.h9
3 files changed, 16 insertions, 10 deletions
diff --git a/balance.cc b/balance.cc
index 2c9569a4..b3ecf593 100644
--- a/balance.cc
+++ b/balance.cc
@@ -43,7 +43,7 @@ void report_balances(std::ostream& out, std::vector<entry *>& ledger,
std::cout.width(10);
std::cout << std::right << "Cleared" << std::endl;
- for (std::map<const std::string, account *>::iterator i = accounts.begin();
+ for (accounts_iterator i = accounts.begin();
i != accounts.end();
i++) {
if (! show_empty && ! (*i).second->future)
@@ -108,13 +108,12 @@ void report_balances(std::ostream& out, std::vector<entry *>& ledger,
#if 0
if (regexps.empty()) {
#endif
- // jww (2003-09-29): Let `totals' be streamed
- future_balance.print(std::cout);
- std::cout << " ";
- current_balance.print(std::cout);
- std::cout << " ";
- cleared_balance.print(std::cout);
- std::cout << std::endl;
+ std::cout.width(10);
+ std::cout << std::right << future_balance << " ";
+ std::cout.width(10);
+ std::cout << std::right << current_balance << " ";
+ std::cout.width(10);
+ std::cout << std::right << cleared_balance << std::endl;
#if 0
}
#endif
diff --git a/ledger.cc b/ledger.cc
index 64a2381a..88a9d0b7 100644
--- a/ledger.cc
+++ b/ledger.cc
@@ -89,7 +89,7 @@ totals::operator bool() const
void totals::print(std::ostream& out) const
{
for (const_iterator_t i = amounts.begin(); i != amounts.end(); i++)
- std::cout << (*i).first << " = " << *((*i).second) << std::endl;
+ std::cout << (*i).first << " = " << *((*i).second);
}
amount * totals::value(const std::string& commodity)
diff --git a/ledger.h b/ledger.h
index 0e261ceb..99287cc6 100644
--- a/ledger.h
+++ b/ledger.h
@@ -1,5 +1,5 @@
#ifndef _LEDGER_H
-#define _LEDGER_H "$Revision: 1.1 $"
+#define _LEDGER_H "$Revision: 1.2 $"
//////////////////////////////////////////////////////////////////////
//
@@ -210,6 +210,13 @@ class totals
}
};
+template<class Traits>
+std::basic_ostream<char, Traits> &
+operator<<(std::basic_ostream<char, Traits>& out, const totals& t) {
+ t.print(out);
+ return out;
+}
+
struct account
{
std::string name;