From 0fdb900c9975b97b43fe85c2691a9d5e69006fab Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 27 Oct 2009 07:15:41 -0400 Subject: Redid the way temporaries are handled in filtering --- src/account.h | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'src/account.h') diff --git a/src/account.h b/src/account.h index d860d955..428f6c63 100644 --- a/src/account.h +++ b/src/account.h @@ -55,7 +55,7 @@ class account_t; class xact_t; class post_t; -typedef std::deque posts_deque; +typedef std::list posts_list; typedef std::map accounts_map; /** @@ -63,35 +63,37 @@ typedef std::map accounts_map; * * Long. */ -class account_t : public scope_t +class account_t : public supports_flags<>, public scope_t { - public: +#define ACCOUNT_NORMAL 0x00 // no flags at all, a basic account +#define ACCOUNT_KNOWN 0x01 +#define ACCOUNT_TEMP 0x02 // account is a temporary object + +public: account_t * parent; string name; optional note; unsigned short depth; accounts_map accounts; - posts_deque posts; - bool known; + posts_list posts; mutable string _fullname; account_t(account_t * _parent = NULL, const string& _name = "", const optional& _note = none) - : scope_t(), parent(_parent), name(_name), note(_note), - depth(static_cast(parent ? parent->depth + 1 : 0)), - known(false) { + : supports_flags<>(), scope_t(), parent(_parent), + name(_name), note(_note), + depth(static_cast(parent ? parent->depth + 1 : 0)) { TRACE_CTOR(account_t, "account_t *, const string&, const string&"); } account_t(const account_t& other) - : scope_t(), + : supports_flags<>(other.flags()), scope_t(), parent(other.parent), name(other.name), note(other.note), depth(other.depth), - accounts(other.accounts), - known(other.known) { + accounts(other.accounts) { TRACE_CTOR(account_t, "copy"); } ~account_t(); @@ -116,6 +118,7 @@ class account_t : public scope_t void add_post(post_t * post) { posts.push_back(post); } + bool remove_post(post_t * post); virtual expr_t::ptr_op_t lookup(const string& name); @@ -152,12 +155,12 @@ class account_t : public scope_t date_t latest_post; date_t latest_cleared_post; - std::size_t last_size; - std::set filenames; std::set accounts_referenced; std::set payees_referenced; + optional last_post; + details_t() : calculated(false), gathered(false), @@ -167,9 +170,7 @@ class account_t : public scope_t posts_cleared_count(0), posts_last_7_count(0), posts_last_30_count(0), - posts_this_month_count(0), - - last_size(0) {} + posts_this_month_count(0) {} details_t& operator+=(const details_t& other); @@ -227,7 +228,7 @@ class account_t : public scope_t const xdata_t::details_t& self_details(bool gather_all = true) const; const xdata_t::details_t& family_details(bool gather_all = true) const; - bool has_flags(xdata_t::flags_t flags) const { + bool has_xflags(xdata_t::flags_t flags) const { return xdata_ && xdata_->has_flags(flags); } std::size_t children_with_flags(xdata_t::flags_t flags) const; -- cgit v1.2.3