summaryrefslogtreecommitdiff
path: root/src/account.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-10-27 07:15:41 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-10-27 08:30:39 -0400
commit0fdb900c9975b97b43fe85c2691a9d5e69006fab (patch)
tree833ced95e5bd15a2bce802cd474f3c0fd93a88f7 /src/account.h
parentf20b6a3b9edc2ace7b85eb4c961d57f69d98ea09 (diff)
downloadfork-ledger-0fdb900c9975b97b43fe85c2691a9d5e69006fab.tar.gz
fork-ledger-0fdb900c9975b97b43fe85c2691a9d5e69006fab.tar.bz2
fork-ledger-0fdb900c9975b97b43fe85c2691a9d5e69006fab.zip
Redid the way temporaries are handled in filtering
Diffstat (limited to 'src/account.h')
-rw-r--r--src/account.h35
1 files changed, 18 insertions, 17 deletions
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<post_t *> posts_deque;
+typedef std::list<post_t *> posts_list;
typedef std::map<const string, account_t *> accounts_map;
/**
@@ -63,35 +63,37 @@ typedef std::map<const string, account_t *> 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<string> 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<string>& _note = none)
- : scope_t(), parent(_parent), name(_name), note(_note),
- depth(static_cast<unsigned short>(parent ? parent->depth + 1 : 0)),
- known(false) {
+ : supports_flags<>(), scope_t(), parent(_parent),
+ name(_name), note(_note),
+ depth(static_cast<unsigned short>(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<path> filenames;
std::set<string> accounts_referenced;
std::set<string> payees_referenced;
+ optional<posts_list::const_iterator> 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;