summaryrefslogtreecommitdiff
path: root/balance.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2004-08-29 04:31:59 -0400
committerJohn Wiegley <johnw@newartisans.com>2004-08-29 04:31:59 -0400
commit2d62f7b633bdaa39c650bb67425514cf1e66a4dd (patch)
treeffe42356e5e83f2cbc2cce74a8566ea1ac738e8b /balance.cc
parent032afa5657bd600476cde256b6d7db84fde7d038 (diff)
downloadfork-ledger-2d62f7b633bdaa39c650bb67425514cf1e66a4dd.tar.gz
fork-ledger-2d62f7b633bdaa39c650bb67425514cf1e66a4dd.tar.bz2
fork-ledger-2d62f7b633bdaa39c650bb67425514cf1e66a4dd.zip
redid the way amount_t::commodity is handled; no more direct access
Diffstat (limited to 'balance.cc')
-rw-r--r--balance.cc13
1 files changed, 3 insertions, 10 deletions
diff --git a/balance.cc b/balance.cc
index f6392536..69066f97 100644
--- a/balance.cc
+++ b/balance.cc
@@ -5,7 +5,7 @@
namespace ledger {
-amount_t balance_t::amount(const commodity_t * commodity) const
+amount_t balance_t::amount(const commodity_t& commodity) const
{
if (! commodity) {
if (amounts.size() == 1) {
@@ -14,7 +14,7 @@ amount_t balance_t::amount(const commodity_t * commodity) const
}
}
else if (amounts.size() > 0) {
- amounts_map::const_iterator i = amounts.find(commodity);
+ amounts_map::const_iterator i = amounts.find(&commodity);
if (i != amounts.end())
return (*i).second;
}
@@ -35,7 +35,7 @@ balance_t balance_t::value(const std::time_t moment) const
struct compare_amount_commodities {
bool operator()(const amount_t * left, const amount_t * right) const {
- return left->commodity->symbol < right->commodity->symbol;
+ return left->commodity().symbol < right->commodity().symbol;
}
};
@@ -136,13 +136,6 @@ void export_balance()
.def(init<unsigned int>())
.def(init<double>())
- .def(self < other<unsigned int>())
- .def(self <= other<unsigned int>())
- .def(self > other<unsigned int>())
- .def(self >= other<unsigned int>())
- .def(self == other<unsigned int>())
- .def(self != other<unsigned int>())
-
.def(self += self)
.def(self += other<amount_t>())
.def(self + self)