summaryrefslogtreecommitdiff
path: root/src/amount.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-07 19:36:47 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-07 19:36:51 -0400
commit4a28e1765caff97b4c89884b6511a60d009211d8 (patch)
treec8c733b4c30250b912f9cd804338a065e99474b1 /src/amount.cc
parent19a59079fa1945d56605539dcc75e79cf9549fb2 (diff)
downloadfork-ledger-4a28e1765caff97b4c89884b6511a60d009211d8.tar.gz
fork-ledger-4a28e1765caff97b4c89884b6511a60d009211d8.tar.bz2
fork-ledger-4a28e1765caff97b4c89884b6511a60d009211d8.zip
Fixed some #include ordering issues.
Diffstat (limited to 'src/amount.cc')
-rw-r--r--src/amount.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/amount.cc b/src/amount.cc
index 829b31ef..13630eb2 100644
--- a/src/amount.cc
+++ b/src/amount.cc
@@ -30,6 +30,7 @@
*/
#include "amount.h"
+#include "commodity.h"
namespace ledger {
@@ -661,6 +662,15 @@ bool amount_t::fits_in_long() const
return mpfr_fits_slong_p(tempf, GMP_RNDN);
}
+commodity_t& amount_t::commodity() const
+{
+ return has_commodity() ? *commodity_ : *current_pool->null_commodity;
+}
+
+bool amount_t::has_commodity() const
+{
+ return commodity_ && commodity_ != commodity_->parent().null_commodity;
+}
void amount_t::annotate(const annotation_t& details)
{