summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/filters.cc8
-rw-r--r--src/item.cc12
-rw-r--r--src/post.cc6
-rw-r--r--src/post.h5
-rw-r--r--src/xact.cc5
5 files changed, 19 insertions, 17 deletions
diff --git a/src/filters.cc b/src/filters.cc
index ade349bd..8b5bca1e 100644
--- a/src/filters.cc
+++ b/src/filters.cc
@@ -351,7 +351,7 @@ void related_posts::flush()
post_t::xdata_t& xdata(r_post->xdata());
if (! xdata.has_flags(POST_EXT_HANDLED) &&
(! xdata.has_flags(POST_EXT_RECEIVED) ?
- ! r_post->has_flags(POST_AUTO | POST_VIRTUAL) :
+ ! r_post->has_flags(ITEM_GENERATED | POST_VIRTUAL) :
also_matching)) {
xdata.add_flags(POST_EXT_HANDLED);
item_handler<post_t>::operator()(*r_post);
@@ -363,7 +363,7 @@ void related_posts::flush()
// output auto or period xacts.
post_t::xdata_t& xdata(post->xdata());
if (! xdata.has_flags(POST_EXT_HANDLED) &&
- ! post->has_flags(POST_AUTO)) {
+ ! post->has_flags(ITEM_GENERATED)) {
xdata.add_flags(POST_EXT_HANDLED);
item_handler<post_t>::operator()(*post);
}
@@ -720,7 +720,7 @@ void budget_posts::report_budget_items(const date_t& date)
post_temps.push_back(post);
post_t& temp = post_temps.back();
temp.xact = &xact;
- temp.add_flags(POST_AUTO | ITEM_TEMP);
+ temp.add_flags(ITEM_TEMP);
temp.amount.in_place_negate();
xact.add_post(&temp);
@@ -808,7 +808,7 @@ void forecast_posts::flush()
post_temps.push_back(post);
post_t& temp = post_temps.back();
temp.xact = &xact;
- temp.add_flags(POST_AUTO | ITEM_TEMP);
+ temp.add_flags(ITEM_TEMP);
xact.add_post(&temp);
date_t next = (*least).first.increment(begin);
diff --git a/src/item.cc b/src/item.cc
index 27fc6ef3..c6aed1a1 100644
--- a/src/item.cc
+++ b/src/item.cc
@@ -180,6 +180,10 @@ namespace {
return item.state() == item_t::PENDING;
}
+ value_t get_actual(item_t& item) {
+ return ! item.has_flags(ITEM_GENERATED);
+ }
+
value_t get_date(item_t& item) {
return item.date();
}
@@ -196,8 +200,7 @@ namespace {
else if (args[0].is_mask())
return item.has_tag(args[0].as_mask());
} else {
- return item.has_tag(args[0].to_mask(),
- args[1].to_mask());
+ return item.has_tag(args[0].to_mask(), args[1].to_mask());
}
return false;
}
@@ -265,6 +268,11 @@ value_t get_comment(item_t& item)
expr_t::ptr_op_t item_t::lookup(const string& name)
{
switch (name[0]) {
+ case 'a':
+ if (name == "actual")
+ return WRAP_FUNCTOR(get_wrapper<&get_actual>);
+ break;
+
case 'b':
if (name == "beg_line")
return WRAP_FUNCTOR(get_wrapper<&get_beg_line>);
diff --git a/src/post.cc b/src/post.cc
index e87a1cbc..366af008 100644
--- a/src/post.cc
+++ b/src/post.cc
@@ -130,10 +130,6 @@ namespace {
return ! post.has_flags(POST_VIRTUAL);
}
- value_t get_actual(post_t& post) {
- return ! post.has_flags(POST_AUTO);
- }
-
value_t get_xact(post_t& post) {
return value_t(static_cast<scope_t *>(post.xact));
}
@@ -234,8 +230,6 @@ expr_t::ptr_op_t post_t::lookup(const string& name)
return WRAP_FUNCTOR(get_account);
else if (name == "account_base")
return WRAP_FUNCTOR(get_wrapper<&get_account_base>);
- else if (name == "actual")
- return WRAP_FUNCTOR(get_wrapper<&get_actual>);
break;
case 'c':
diff --git a/src/post.h b/src/post.h
index 84c0d929..a8e8ab3d 100644
--- a/src/post.h
+++ b/src/post.h
@@ -65,9 +65,8 @@ class post_t : public item_t
{
public:
#define POST_VIRTUAL 0x10 // the account was specified with (parens)
-#define POST_MUST_BALANCE 0x20 // the account was specified with [brackets]
-#define POST_AUTO 0x40 // posting created by automated xact
-#define POST_CALCULATED 0x80 // posting's amount was auto-calculated
+#define POST_MUST_BALANCE 0x20 // posting must balance in the transaction
+#define POST_CALCULATED 0x40 // posting's amount was calculated
xact_t * xact; // only set for posts of regular xacts
account_t * account;
diff --git a/src/xact.cc b/src/xact.cc
index 1b08c667..c67ecf12 100644
--- a/src/xact.cc
+++ b/src/xact.cc
@@ -362,7 +362,8 @@ void auto_xact_t::extend_xact(xact_base_t& xact, bool post_handler)
posts_list initial_posts(xact.posts.begin(), xact.posts.end());
foreach (post_t * initial_post, initial_posts) {
- if (! initial_post->has_flags(POST_AUTO) && predicate(*initial_post)) {
+ if (! initial_post->has_flags(ITEM_GENERATED) &&
+ predicate(*initial_post)) {
foreach (post_t * post, posts) {
amount_t amt;
assert(post->amount);
@@ -408,7 +409,7 @@ void auto_xact_t::extend_xact(xact_base_t& xact, bool post_handler)
// the automated xact's one.
post_t * new_post = new post_t(account, amt);
new_post->copy_details(*post);
- new_post->add_flags(POST_AUTO);
+ new_post->add_flags(ITEM_GENERATED);
xact.add_post(new_post);
}