diff options
author | John Wiegley <johnw@newartisans.com> | 2009-11-02 16:57:53 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-11-02 16:57:53 -0500 |
commit | 3f8c126c798d575d27d199ee3337499f338dc1ee (patch) | |
tree | b0c3f6500f142e4085f889ab498b2f7f65109c2b | |
parent | ede73e8889ce4c5b45ce837f312047b8d259fecf (diff) | |
download | fork-ledger-3f8c126c798d575d27d199ee3337499f338dc1ee.tar.gz fork-ledger-3f8c126c798d575d27d199ee3337499f338dc1ee.tar.bz2 fork-ledger-3f8c126c798d575d27d199ee3337499f338dc1ee.zip |
Use is_annotated() method rather than "annotated"
-rw-r--r-- | src/amount.cc | 6 | ||||
-rw-r--r-- | src/annotate.cc | 4 | ||||
-rw-r--r-- | src/annotate.h | 9 | ||||
-rw-r--r-- | src/commodity.cc | 8 |
4 files changed, 16 insertions, 11 deletions
diff --git a/src/amount.cc b/src/amount.cc index 3ac47c59..435cdea4 100644 --- a/src/amount.cc +++ b/src/amount.cc @@ -783,7 +783,7 @@ void amount_t::annotate(const annotation_t& details) else if (! has_commodity()) return; // ignore attempt to annotate a "bare commodity - if (commodity().annotated) { + if (commodity().is_annotated()) { this_ann = &as_annotated_commodity(commodity()); this_base = &this_ann->referent(); } else { @@ -811,9 +811,9 @@ bool amount_t::is_annotated() const throw_(amount_error, _("Cannot determine if an uninitialized amount's commodity is annotated")); - assert(! has_commodity() || ! commodity().annotated || + assert(! has_commodity() || ! commodity().is_annotated() || as_annotated_commodity(commodity()).details); - return has_commodity() && commodity().annotated; + return has_commodity() && commodity().is_annotated(); } annotation_t& amount_t::annotation() diff --git a/src/annotate.cc b/src/annotate.cc index c6084f7f..9c676086 100644 --- a/src/annotate.cc +++ b/src/annotate.cc @@ -135,13 +135,13 @@ void annotation_t::print(std::ostream& out, bool keep_base) const bool keep_details_t::keep_all(const commodity_t& comm) const { - return (! comm.annotated || + return (! comm.is_annotated() || (keep_price && keep_date && keep_tag && ! only_actuals)); } bool keep_details_t::keep_any(const commodity_t& comm) const { - return comm.annotated && (keep_price || keep_date || keep_tag); + return comm.is_annotated() && (keep_price || keep_date || keep_tag); } bool annotated_commodity_t::operator==(const commodity_t& comm) const diff --git a/src/annotate.h b/src/annotate.h index 77dd9372..cb2a1161 100644 --- a/src/annotate.h +++ b/src/annotate.h @@ -185,9 +185,10 @@ class annotated_commodity_t equality_comparable2<annotated_commodity_t, commodity_t, noncopyable> > { -public: +protected: + friend class commodity_pool_t; + commodity_t * ptr; - annotation_t details; explicit annotated_commodity_t(commodity_t * _ptr, const annotation_t& _details) @@ -195,6 +196,10 @@ public: TRACE_CTOR(annotated_commodity_t, "commodity_t *, annotation_t"); annotated = true; } + +public: + annotation_t details; + virtual ~annotated_commodity_t() { TRACE_DTOR(annotated_commodity_t); } diff --git a/src/commodity.cc b/src/commodity.cc index 689cf466..26038a0b 100644 --- a/src/commodity.cc +++ b/src/commodity.cc @@ -604,11 +604,11 @@ bool compare_amount_commodities::operator()(const amount_t * left, if (cmp != 0) return cmp < 0; - if (! leftcomm.annotated) { - return rightcomm.annotated; + if (! leftcomm.is_annotated()) { + return rightcomm.is_annotated(); } - else if (! rightcomm.annotated) { - return ! leftcomm.annotated; + else if (! rightcomm.is_annotated()) { + return ! leftcomm.is_annotated(); } else { annotated_commodity_t& aleftcomm(static_cast<annotated_commodity_t&>(leftcomm)); |