summaryrefslogtreecommitdiff
path: root/src/amount.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-03-30 00:38:29 -0500
committerJohn Wiegley <johnw@newartisans.com>2012-03-30 00:51:05 -0500
commit8e8c2904f55eb9a43b3eb8057e9f11767a624dff (patch)
treebd7473e6ca867ab8a2fe10cc657484810e8daac7 /src/amount.h
parent4b2b9dc009e5f44029cc23ea17e0a5c98266baff (diff)
downloadfork-ledger-8e8c2904f55eb9a43b3eb8057e9f11767a624dff.tar.gz
fork-ledger-8e8c2904f55eb9a43b3eb8057e9f11767a624dff.tar.bz2
fork-ledger-8e8c2904f55eb9a43b3eb8057e9f11767a624dff.zip
Never price commodities using annotated commodities
Diffstat (limited to 'src/amount.h')
-rw-r--r--src/amount.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/amount.h b/src/amount.h
index 10e83552..cd77a79a 100644
--- a/src/amount.h
+++ b/src/amount.h
@@ -544,6 +544,15 @@ public:
*this = 0L;
commodity_ = &comm;
}
+ amount_t with_commodity(const commodity_t& comm) const {
+ if (commodity_ == &comm) {
+ return *this;
+ } else {
+ amount_t tmp(*this);
+ tmp.set_commodity(const_cast<commodity_t&>(comm));
+ return tmp;
+ }
+ }
void clear_commodity() {
commodity_ = NULL;
}