summaryrefslogtreecommitdiff
path: root/balance.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2008-07-17 21:22:24 -0400
committerJohn Wiegley <johnw@newartisans.com>2008-07-17 21:22:24 -0400
commit30fb235841276f32c233bc8d41369a937d1f32be (patch)
tree7dfad7c51a0cfa9753c7551d8ad421282380497b /balance.h
parent6cb519231fba70ae5b84c1ae60aa8a653b14aa2e (diff)
downloadfork-ledger-30fb235841276f32c233bc8d41369a937d1f32be.tar.gz
fork-ledger-30fb235841276f32c233bc8d41369a937d1f32be.tar.bz2
fork-ledger-30fb235841276f32c233bc8d41369a937d1f32be.zip
Added helper methods for comparing a balance to a balance_pair.
Diffstat (limited to 'balance.h')
-rw-r--r--balance.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/balance.h b/balance.h
index ba76d459..24b1f2dc 100644
--- a/balance.h
+++ b/balance.h
@@ -926,6 +926,22 @@ class balance_pair_t
temp.cost = new balance_t(cost->unround());
return temp;
}
+
+ friend inline bool operator<(const balance_t& bal, const balance_pair_t& bal_pair) {
+ return bal_pair >= bal;
+ }
+ friend inline bool operator<=(const balance_t& bal, const balance_pair_t& bal_pair) {
+ return bal_pair > bal;
+ }
+ friend inline bool operator>(const balance_t& bal, const balance_pair_t& bal_pair) {
+ return bal_pair <= bal;
+ }
+ friend inline bool operator>=(const balance_t& bal, const balance_pair_t& bal_pair) {
+ return bal_pair < bal;
+ }
+ friend inline bool operator==(const balance_t& bal, const balance_pair_t& bal_pair) {
+ return bal_pair == bal;
+ }
};
inline balance_pair_t abs(const balance_pair_t& bal_pair) {