diff options
author | John Wiegley <johnw@newartisans.com> | 2010-06-09 05:44:06 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-06-09 05:44:06 -0400 |
commit | 14476a63f4abbdce5311ace031b7345a34af060b (patch) | |
tree | c1900d4f2a95db2cdb4cf7404669fe668acedb4a /src/post.cc | |
parent | e8ffbd6f2fb57f2b65f57f92edf8eb444cc2f71f (diff) | |
parent | 474d95adeb09b0c13f0e19b336b5b01ee69c6275 (diff) | |
download | fork-ledger-14476a63f4abbdce5311ace031b7345a34af060b.tar.gz fork-ledger-14476a63f4abbdce5311ace031b7345a34af060b.tar.bz2 fork-ledger-14476a63f4abbdce5311ace031b7345a34af060b.zip |
Merge branch 'next'
Diffstat (limited to 'src/post.cc')
-rw-r--r-- | src/post.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/post.cc b/src/post.cc index 7dc15830..e182a731 100644 --- a/src/post.cc +++ b/src/post.cc @@ -78,6 +78,13 @@ optional<string> post_t::get_tag(const mask_t& tag_mask, return none; } +date_t post_t::value_date() const +{ + if (xdata_ && is_valid(xdata_->value_date)) + return xdata_->value_date; + return date(); +} + date_t post_t::date() const { if (xdata_ && is_valid(xdata_->date)) @@ -319,6 +326,14 @@ namespace { return long(post.reported_account()->depth); } + value_t get_value_date(post_t& post) { + if (post.has_xdata()) { + post_t::xdata_t& xdata(post.xdata()); + if (! xdata.value_date.is_not_a_date()) + return xdata.value_date; + } + return post.date(); + } value_t get_datetime(post_t& post) { return post.xdata().datetime; } @@ -479,6 +494,8 @@ expr_t::ptr_op_t post_t::lookup(const symbol_t::kind_t kind, case 'v': if (name == "virtual") return WRAP_FUNCTOR(get_wrapper<&get_virtual>); + else if (name == "value_date") + return WRAP_FUNCTOR(get_wrapper<&get_value_date>); break; case 'x': |