diff options
author | John Wiegley <johnw@newartisans.com> | 2004-08-23 18:23:31 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2004-08-23 18:23:31 -0400 |
commit | 73e2abd1b2e2bacbd353999a7b3edd95a04112c4 (patch) | |
tree | 4ae4a6a5355913345877b593bcc530f001660b26 /amount.cc | |
parent | 632a37034a4d3a3cc2ad2bb786709c2497c5c97f (diff) | |
download | fork-ledger-73e2abd1b2e2bacbd353999a7b3edd95a04112c4.tar.gz fork-ledger-73e2abd1b2e2bacbd353999a7b3edd95a04112c4.tar.bz2 fork-ledger-73e2abd1b2e2bacbd353999a7b3edd95a04112c4.zip |
a little cleanup; reversed the meaning of -z and -p (to be more mnemonic)
Diffstat (limited to 'amount.cc')
-rw-r--r-- | amount.cc | 19 |
1 files changed, 8 insertions, 11 deletions
@@ -585,15 +585,17 @@ amount_t amount_t::round(unsigned int prec) const } } -std::ostream& operator<<(std::ostream& out, const amount_t& amt) +std::ostream& operator<<(std::ostream& _out, const amount_t& amt) { + if (! amt.quantity) + return _out; + + std::ostringstream out; + mpz_t quotient; mpz_t rquotient; mpz_t remainder; - if (! amt.quantity) - return out; - mpz_init(quotient); mpz_init(rquotient); mpz_init(remainder); @@ -710,14 +712,9 @@ std::ostream& operator<<(std::ostream& out, const amount_t& amt) mpz_clear(rquotient); mpz_clear(remainder); - return out; -} + _out << out.str(); -amount_t::operator std::string() const -{ - std::ostringstream s; - s << *this; - return s.str(); + return _out; } void parse_quantity(std::istream& in, std::string& value) |