summaryrefslogtreecommitdiff
path: root/src/balance.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-11-21 15:19:42 -0500
committerJohn Wiegley <johnw@newartisans.com>2009-11-21 15:19:42 -0500
commitf01fa1a5131c287a4efe2708ffe3c9bc57b79468 (patch)
tree2a2f732edd59c4f42c1eb3e9a9e95ff135091bab /src/balance.h
parent117dddabd4f883de4f464821f9567d889a6fa449 (diff)
parentacb24d6d22e19d4f6b3883c029dd9fef5c1c9529 (diff)
downloadfork-ledger-f01fa1a5131c287a4efe2708ffe3c9bc57b79468.tar.gz
fork-ledger-f01fa1a5131c287a4efe2708ffe3c9bc57b79468.tar.bz2
fork-ledger-f01fa1a5131c287a4efe2708ffe3c9bc57b79468.zip
Merge branch 'next'
Diffstat (limited to 'src/balance.h')
-rw-r--r--src/balance.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/balance.h b/src/balance.h
index 8a40dea9..826de134 100644
--- a/src/balance.h
+++ b/src/balance.h
@@ -461,6 +461,15 @@ public:
* Conversion methods. A balance can be converted to an amount, but
* only if contains a single component amount.
*/
+ operator string() const {
+ return to_string();
+ }
+ string to_string() const {
+ std::ostringstream buf;
+ print(buf);
+ return buf.str();
+ }
+
amount_t to_amount() const {
if (is_empty())
throw_(balance_error, _("Cannot convert an empty balance to an amount"));
@@ -532,8 +541,8 @@ public:
void print(std::ostream& out,
const int first_width = -1,
const int latter_width = -1,
- const bool right_justify = true,
- const bool colorize = true) const;
+ const bool right_justify = false,
+ const bool colorize = false) const;
/**
* Debugging methods. There are two methods defined to help with