summaryrefslogtreecommitdiff
path: root/src/xact.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-14 05:37:53 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-14 05:37:53 -0400
commitee5e0600aaa63859b9452d981ea9dd29b581b216 (patch)
tree91f087a8c701f6dca8ddf2e35a4bba107866bb3e /src/xact.cc
parent67d63366cb1c7e1bc528f625c28437ca19ab927e (diff)
downloadfork-ledger-ee5e0600aaa63859b9452d981ea9dd29b581b216.tar.gz
fork-ledger-ee5e0600aaa63859b9452d981ea9dd29b581b216.tar.bz2
fork-ledger-ee5e0600aaa63859b9452d981ea9dd29b581b216.zip
xact metadata searches get passed up to the entry
That is, if a metadata tag cannot be found in a transaction, look in the parent entry to see if it was set there. Transactions "inherit" notational details from their entries.
Diffstat (limited to 'src/xact.cc')
-rw-r--r--src/xact.cc38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/xact.cc b/src/xact.cc
index 24846cf2..0e287962 100644
--- a/src/xact.cc
+++ b/src/xact.cc
@@ -36,6 +36,44 @@
namespace ledger {
+bool xact_t::has_tag(const string& tag) const
+{
+ if (item_t::has_tag(tag))
+ return true;
+ if (entry)
+ return entry->has_tag(tag);
+ return false;
+}
+
+bool xact_t::has_tag(const mask_t& tag_mask,
+ const optional<mask_t>& value_mask) const
+{
+ if (item_t::has_tag(tag_mask, value_mask))
+ return true;
+ if (entry)
+ return entry->has_tag(tag_mask, value_mask);
+ return false;
+}
+
+optional<string> xact_t::get_tag(const string& tag) const
+{
+ if (optional<string> value = item_t::get_tag(tag))
+ return value;
+ if (entry)
+ return entry->get_tag(tag);
+ return none;
+}
+
+optional<string> xact_t::get_tag(const mask_t& tag_mask,
+ const optional<mask_t>& value_mask) const
+{
+ if (optional<string> value = item_t::get_tag(tag_mask, value_mask))
+ return value;
+ if (entry)
+ return entry->get_tag(tag_mask, value_mask);
+ return none;
+}
+
date_t xact_t::date() const
{
if (item_t::use_effective_date) {