diff options
author | John Wiegley <johnw@newartisans.com> | 2007-05-21 20:45:13 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 03:39:06 -0400 |
commit | d23ed020abf494a046b499cdce1c0957cd5b4783 (patch) | |
tree | bd9035df62b9ef7cbf77045bb018de8e33270fca /src/numerics/amount.cc | |
parent | fdfc37adf948415b6caad55c08e8313abd4e1b1b (diff) | |
download | fork-ledger-d23ed020abf494a046b499cdce1c0957cd5b4783.tar.gz fork-ledger-d23ed020abf494a046b499cdce1c0957cd5b4783.tar.bz2 fork-ledger-d23ed020abf494a046b499cdce1c0957cd5b4783.zip |
Whitespace cleanup.
Diffstat (limited to 'src/numerics/amount.cc')
-rw-r--r-- | src/numerics/amount.cc | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/numerics/amount.cc b/src/numerics/amount.cc index 4c771cc7..79dd663c 100644 --- a/src/numerics/amount.cc +++ b/src/numerics/amount.cc @@ -33,9 +33,9 @@ * @file amount.cc * @author John Wiegley * @date Thu Apr 26 15:19:46 2007 - * + * * @brief Types for handling commoditized math. - * + * * This file defines member functions for amount_t, and also defines a * helper class, bigint_t, which is used as a refcounted wrapper * around libgmp's mpz_t type. @@ -43,6 +43,7 @@ #include "amount.h" #include "binary.h" +#include "parser.h" namespace ledger { @@ -330,7 +331,7 @@ int amount_t::compare(const amount_t& amt) const else throw_(amount_error, "Cannot compare two uninitialized amounts"); } - + if (has_commodity() && amt.has_commodity() && commodity() != amt.commodity()) throw_(amount_error, @@ -363,7 +364,7 @@ amount_t& amount_t::operator+=(const amount_t& amt) else throw_(amount_error, "Cannot add two uninitialized amounts"); } - + if (commodity() != amt.commodity()) throw_(amount_error, "Adding amounts with different commodities: " << @@ -399,7 +400,7 @@ amount_t& amount_t::operator-=(const amount_t& amt) else throw_(amount_error, "Cannot subtract two uninitialized amounts"); } - + if (commodity() != amt.commodity()) throw_(amount_error, "Subtracting amounts with different commodities: " << @@ -483,7 +484,7 @@ amount_t& amount_t::operator*=(const amount_t& amt) else throw_(amount_error, "Cannot multiply two uninitialized amounts"); } - + if (has_commodity() && amt.has_commodity() && commodity() != amt.commodity()) throw_(amount_error, @@ -521,7 +522,7 @@ amount_t& amount_t::operator/=(const amount_t& amt) else throw_(amount_error, "Cannot divide two uninitialized amounts"); } - + if (has_commodity() && amt.has_commodity() && commodity() != amt.commodity()) throw_(amount_error, @@ -1218,10 +1219,10 @@ namespace { void amount_t::read(std::istream& in) { - using ledger::binary; + using namespace ledger::binary; // Read in the commodity for this amount - + commodity_t::ident_t ident; read_long(in, ident); if (ident == 0xffffffff) @@ -1266,10 +1267,10 @@ void amount_t::read(std::istream& in) void amount_t::read(const char *& data) { - using ledger::binary; - + using namespace ledger::binary; + // Read in the commodity for this amount - + commodity_t::ident_t ident; read_long(data, ident); if (ident == 0xffffffff) @@ -1323,10 +1324,10 @@ void amount_t::read(const char *& data) void amount_t::write(std::ostream& out, bool optimized) const { - using ledger::binary; - + using namespace ledger::binary; + // Write out the commodity for this amount - + if (! quantity) throw_(amount_error, "Cannot serialize an uninitialized amount"); |