From b80be82b8d4a3aaf226b00e7c12520318346ccea Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 18 Jun 2010 02:19:39 -0400 Subject: has_tag and get_tag now take an 'inherit' parameter --- src/post.cc | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/post.cc') 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& value_mask) const + const optional& 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 post_t::get_tag(const string& tag) const +optional post_t::get_tag(const string& tag, bool inherit) const { if (optional value = item_t::get_tag(tag)) return value; - if (xact) + if (inherit && xact) return xact->get_tag(tag); return none; } optional post_t::get_tag(const mask_t& tag_mask, - const optional& value_mask) const + const optional& value_mask, + bool inherit) const { if (optional 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; } -- cgit v1.2.3