diff options
Diffstat (limited to 'src/xact.h')
-rw-r--r-- | src/xact.h | 74 |
1 files changed, 70 insertions, 4 deletions
@@ -106,7 +106,7 @@ class xact_t : public xact_base_t { public: optional<string> code; - string payee; + string payee; xact_t() { TRACE_CTOR(xact_t, ""); @@ -117,13 +117,23 @@ public: TRACE_DTOR(xact_t); } + virtual string description() { + if (pos) { + std::ostringstream buf; + buf << _("transaction at line %1") << pos->beg_line; + return buf.str(); + } else { + return string(_("generated transaction")); + } + } + virtual void add_post(post_t * post); string idstring() const; string id() const; virtual expr_t::ptr_op_t lookup(const symbol_t::kind_t kind, - const string& name); + const string& name); virtual bool valid() const; @@ -150,6 +160,32 @@ public: std::map<string, bool> memoized_results; + enum xact_expr_kind_t { + EXPR_GENERAL, + EXPR_ASSERTION, + EXPR_CHECK + }; + + typedef std::pair<expr_t, xact_expr_kind_t> check_expr_pair; + typedef std::list<check_expr_pair> check_expr_list; + + optional<check_expr_list> check_exprs; + + struct deferred_tag_data_t { + string tag_data; + bool overwrite_existing; + post_t * apply_to_post; + + deferred_tag_data_t(string _tag_data, + bool _overwrite_existing) + : tag_data(_tag_data), overwrite_existing(_overwrite_existing), + apply_to_post(NULL) {} + }; + + typedef std::list<deferred_tag_data_t> deferred_notes_list; + + optional<deferred_notes_list> deferred_notes; + auto_xact_t() : try_quick_match(true) { TRACE_CTOR(auto_xact_t, ""); } @@ -168,6 +204,24 @@ public: TRACE_DTOR(auto_xact_t); } + virtual string description() { + if (pos) { + std::ostringstream buf; + buf << _("automated transaction at line %1") << pos->beg_line; + return buf.str(); + } else { + return string(_("generated automated transaction")); + } + } + + virtual void parse_tags(const char * p, + scope_t&, + bool overwrite_existing = true) { + if (! deferred_notes) + deferred_notes = deferred_notes_list(); + deferred_notes->push_back(deferred_tag_data_t(p, overwrite_existing)); + } + virtual void extend_xact(xact_base_t& xact); #if defined(HAVE_BOOST_SERIALIZATION) @@ -180,6 +234,8 @@ private: void serialize(Archive& ar, const unsigned int /* version */) { ar & boost::serialization::base_object<xact_base_t>(*this); ar & predicate; + ar & check_exprs; + ar & deferred_notes; } #endif // HAVE_BOOST_SERIALIZATION }; @@ -188,7 +244,7 @@ class period_xact_t : public xact_base_t { public: date_interval_t period; - string period_string; + string period_string; period_xact_t() { TRACE_CTOR(period_xact_t, ""); @@ -206,6 +262,16 @@ class period_xact_t : public xact_base_t TRACE_DTOR(period_xact_t); } + virtual string description() { + if (pos) { + std::ostringstream buf; + buf << _("periodic transaction at line %1") << pos->beg_line; + return buf.str(); + } else { + return string(_("generated periodic transaction")); + } + } + #if defined(HAVE_BOOST_SERIALIZATION) private: /** Serialization. */ @@ -221,7 +287,7 @@ private: #endif // HAVE_BOOST_SERIALIZATION }; -typedef std::list<xact_t *> xacts_list; +typedef std::list<xact_t *> xacts_list; typedef std::list<auto_xact_t *> auto_xacts_list; typedef std::list<period_xact_t *> period_xacts_list; |