Use is_annotated() method rather than "annotated"
This commit is contained in:
parent
ede73e8889
commit
3f8c126c79
4 changed files with 16 additions and 11 deletions
|
|
@ -783,7 +783,7 @@ void amount_t::annotate(const annotation_t& details)
|
||||||
else if (! has_commodity())
|
else if (! has_commodity())
|
||||||
return; // ignore attempt to annotate a "bare commodity
|
return; // ignore attempt to annotate a "bare commodity
|
||||||
|
|
||||||
if (commodity().annotated) {
|
if (commodity().is_annotated()) {
|
||||||
this_ann = &as_annotated_commodity(commodity());
|
this_ann = &as_annotated_commodity(commodity());
|
||||||
this_base = &this_ann->referent();
|
this_base = &this_ann->referent();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -811,9 +811,9 @@ bool amount_t::is_annotated() const
|
||||||
throw_(amount_error,
|
throw_(amount_error,
|
||||||
_("Cannot determine if an uninitialized amount's commodity is annotated"));
|
_("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);
|
as_annotated_commodity(commodity()).details);
|
||||||
return has_commodity() && commodity().annotated;
|
return has_commodity() && commodity().is_annotated();
|
||||||
}
|
}
|
||||||
|
|
||||||
annotation_t& amount_t::annotation()
|
annotation_t& amount_t::annotation()
|
||||||
|
|
|
||||||
|
|
@ -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
|
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));
|
(keep_price && keep_date && keep_tag && ! only_actuals));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool keep_details_t::keep_any(const commodity_t& comm) const
|
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
|
bool annotated_commodity_t::operator==(const commodity_t& comm) const
|
||||||
|
|
|
||||||
|
|
@ -185,9 +185,10 @@ class annotated_commodity_t
|
||||||
equality_comparable2<annotated_commodity_t, commodity_t,
|
equality_comparable2<annotated_commodity_t, commodity_t,
|
||||||
noncopyable> >
|
noncopyable> >
|
||||||
{
|
{
|
||||||
public:
|
protected:
|
||||||
|
friend class commodity_pool_t;
|
||||||
|
|
||||||
commodity_t * ptr;
|
commodity_t * ptr;
|
||||||
annotation_t details;
|
|
||||||
|
|
||||||
explicit annotated_commodity_t(commodity_t * _ptr,
|
explicit annotated_commodity_t(commodity_t * _ptr,
|
||||||
const annotation_t& _details)
|
const annotation_t& _details)
|
||||||
|
|
@ -195,6 +196,10 @@ public:
|
||||||
TRACE_CTOR(annotated_commodity_t, "commodity_t *, annotation_t");
|
TRACE_CTOR(annotated_commodity_t, "commodity_t *, annotation_t");
|
||||||
annotated = true;
|
annotated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
annotation_t details;
|
||||||
|
|
||||||
virtual ~annotated_commodity_t() {
|
virtual ~annotated_commodity_t() {
|
||||||
TRACE_DTOR(annotated_commodity_t);
|
TRACE_DTOR(annotated_commodity_t);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -604,11 +604,11 @@ bool compare_amount_commodities::operator()(const amount_t * left,
|
||||||
if (cmp != 0)
|
if (cmp != 0)
|
||||||
return cmp < 0;
|
return cmp < 0;
|
||||||
|
|
||||||
if (! leftcomm.annotated) {
|
if (! leftcomm.is_annotated()) {
|
||||||
return rightcomm.annotated;
|
return rightcomm.is_annotated();
|
||||||
}
|
}
|
||||||
else if (! rightcomm.annotated) {
|
else if (! rightcomm.is_annotated()) {
|
||||||
return ! leftcomm.annotated;
|
return ! leftcomm.is_annotated();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
annotated_commodity_t& aleftcomm(static_cast<annotated_commodity_t&>(leftcomm));
|
annotated_commodity_t& aleftcomm(static_cast<annotated_commodity_t&>(leftcomm));
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue