summaryrefslogtreecommitdiff
path: root/src/post.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-06-18 02:19:39 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-06-18 02:19:39 -0400
commitb80be82b8d4a3aaf226b00e7c12520318346ccea (patch)
tree54e77b05f0e732fe272e67b1aa0efea91797f145 /src/post.cc
parent5f989f7d9f6f41df90b2272dfcc7c4332f12cfcb (diff)
downloadfork-ledger-b80be82b8d4a3aaf226b00e7c12520318346ccea.tar.gz
fork-ledger-b80be82b8d4a3aaf226b00e7c12520318346ccea.tar.bz2
fork-ledger-b80be82b8d4a3aaf226b00e7c12520318346ccea.zip
has_tag and get_tag now take an 'inherit' parameter
Diffstat (limited to 'src/post.cc')
-rw-r--r--src/post.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/post.cc b/src/post.cc
index 7c42e3c5..4fc34892 100644
--- a/src/post.cc
+++ b/src/post.cc
@@ -39,40 +39,42 @@
namespace ledger {
-bool post_t::has_tag(const string& tag) const
+bool post_t::has_tag(const string& tag, bool inherit) const
{
if (item_t::has_tag(tag))
return true;
- if (xact)
+ if (inherit && xact)
return xact->has_tag(tag);
return false;
}
bool post_t::has_tag(const mask_t& tag_mask,
- const optional<mask_t>& value_mask) const
+ const optional<mask_t>& value_mask,
+ bool inherit) const
{
if (item_t::has_tag(tag_mask, value_mask))
return true;
- if (xact)
+ if (inherit && xact)
return xact->has_tag(tag_mask, value_mask);
return false;
}
-optional<value_t> post_t::get_tag(const string& tag) const
+optional<value_t> post_t::get_tag(const string& tag, bool inherit) const
{
if (optional<value_t> value = item_t::get_tag(tag))
return value;
- if (xact)
+ if (inherit && xact)
return xact->get_tag(tag);
return none;
}
optional<value_t> post_t::get_tag(const mask_t& tag_mask,
- const optional<mask_t>& value_mask) const
+ const optional<mask_t>& value_mask,
+ bool inherit) const
{
if (optional<value_t> value = item_t::get_tag(tag_mask, value_mask))
return value;
- if (xact)
+ if (inherit && xact)
return xact->get_tag(tag_mask, value_mask);
return none;
}