summaryrefslogtreecommitdiff
path: root/src/balance.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-06-11 16:03:50 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-06-11 17:02:25 -0400
commitdea2aed0b509734ec4e1cd163ac2a4f013000da2 (patch)
tree7908da76c67ae5172882306a319bf26df81b73b4 /src/balance.h
parentd580079df892c30d023b3211d6c4611c17b11f8f (diff)
downloadfork-ledger-dea2aed0b509734ec4e1cd163ac2a4f013000da2.tar.gz
fork-ledger-dea2aed0b509734ec4e1cd163ac2a4f013000da2.tar.bz2
fork-ledger-dea2aed0b509734ec4e1cd163ac2a4f013000da2.zip
Untabified all source files
Diffstat (limited to 'src/balance.h')
-rw-r--r--src/balance.h66
1 files changed, 33 insertions, 33 deletions
diff --git a/src/balance.h b/src/balance.h
index 12d7bc02..ac22f3e7 100644
--- a/src/balance.h
+++ b/src/balance.h
@@ -65,19 +65,19 @@ DECLARE_EXCEPTION(balance_error, std::runtime_error);
*/
class balance_t
: public equality_comparable<balance_t,
- equality_comparable<balance_t, amount_t,
- equality_comparable<balance_t, double,
- equality_comparable<balance_t, unsigned long,
- equality_comparable<balance_t, long,
- additive<balance_t,
- additive<balance_t, amount_t,
- additive<balance_t, double,
- additive<balance_t, unsigned long,
- additive<balance_t, long,
- multiplicative<balance_t, amount_t,
- multiplicative<balance_t, double,
- multiplicative<balance_t, unsigned long,
- multiplicative<balance_t, long> > > > > > > > > > > > > >
+ equality_comparable<balance_t, amount_t,
+ equality_comparable<balance_t, double,
+ equality_comparable<balance_t, unsigned long,
+ equality_comparable<balance_t, long,
+ additive<balance_t,
+ additive<balance_t, amount_t,
+ additive<balance_t, double,
+ additive<balance_t, unsigned long,
+ additive<balance_t, long,
+ multiplicative<balance_t, amount_t,
+ multiplicative<balance_t, double,
+ multiplicative<balance_t, unsigned long,
+ multiplicative<balance_t, long> > > > > > > > > > > > > >
{
public:
typedef std::map<commodity_t *, amount_t> amounts_map;
@@ -111,7 +111,7 @@ public:
TRACE_CTOR(balance_t, "const amount_t&");
if (amt.is_null())
throw_(balance_error,
- _("Cannot initialize a balance from an uninitialized amount"));
+ _("Cannot initialize a balance from an uninitialized amount"));
if (! amt.is_realzero())
amounts.insert(amounts_map::value_type(&amt.commodity(), amt));
}
@@ -153,7 +153,7 @@ public:
balance_t& operator=(const amount_t& amt) {
if (amt.is_null())
throw_(balance_error,
- _("Cannot assign an uninitialized amount to a balance"));
+ _("Cannot assign an uninitialized amount to a balance"));
amounts.clear();
if (! amt.is_realzero())
@@ -187,17 +187,17 @@ public:
bool operator==(const balance_t& bal) const {
amounts_map::const_iterator i, j;
for (i = amounts.begin(), j = bal.amounts.begin();
- i != amounts.end() && j != bal.amounts.end();
- i++, j++) {
+ i != amounts.end() && j != bal.amounts.end();
+ i++, j++) {
if (! (i->first == j->first && i->second == j->second))
- return false;
+ return false;
}
return i == amounts.end() && j == bal.amounts.end();
}
bool operator==(const amount_t& amt) const {
if (amt.is_null())
throw_(balance_error,
- _("Cannot compare a balance to an uninitialized amount"));
+ _("Cannot compare a balance to an uninitialized amount"));
if (amt.is_realzero())
return amounts.empty();
@@ -384,8 +384,8 @@ public:
}
optional<balance_t>
- value(const optional<datetime_t>& moment = none,
- const optional<commodity_t&>& in_terms_of = none) const;
+ value(const optional<datetime_t>& moment = none,
+ const optional<commodity_t&>& in_terms_of = none) const;
balance_t price() const;
@@ -417,7 +417,7 @@ public:
foreach (const amounts_map::value_type& pair, amounts)
if (pair.second.is_nonzero())
- return true;
+ return true;
return false;
}
@@ -427,7 +427,7 @@ public:
foreach (const amounts_map::value_type& pair, amounts)
if (! pair.second.is_zero())
- return false;
+ return false;
return true;
}
@@ -437,7 +437,7 @@ public:
foreach (const amounts_map::value_type& pair, amounts)
if (! pair.second.is_realzero())
- return false;
+ return false;
return true;
}
@@ -468,7 +468,7 @@ public:
return amounts.begin()->second;
else
throw_(balance_error,
- _("Cannot convert a balance with multiple commodities to an amount"));
+ _("Cannot convert a balance with multiple commodities to an amount"));
return amount_t();
}
@@ -529,10 +529,10 @@ public:
* relative amounts of those commodities. There is no option to
* change this behavior.
*/
- void print(std::ostream& out,
- const int first_width = -1,
- const int latter_width = -1,
- const uint_least8_t flags = AMOUNT_PRINT_NO_FLAGS) const;
+ void print(std::ostream& out,
+ const int first_width = -1,
+ const int latter_width = -1,
+ const uint_least8_t flags = AMOUNT_PRINT_NO_FLAGS) const;
/**
* Debugging methods. There are two methods defined to help with
@@ -550,9 +550,9 @@ public:
bool first = true;
foreach (const amounts_map::value_type& pair, amounts) {
if (first)
- first = false;
+ first = false;
else
- out << ", ";
+ out << ", ";
pair.second.print(out);
}
out << ")";
@@ -561,8 +561,8 @@ public:
bool valid() const {
foreach (const amounts_map::value_type& pair, amounts)
if (! pair.second.valid()) {
- DEBUG("ledger.validate", "balance_t: ! pair.second.valid()");
- return false;
+ DEBUG("ledger.validate", "balance_t: ! pair.second.valid()");
+ return false;
}
return true;
}