Added 'code' value expression function for xacts and entries.
This commit is contained in:
parent
7d1809cb15
commit
9a98beab38
2 changed files with 21 additions and 0 deletions
12
src/entry.cc
12
src/entry.cc
|
|
@ -380,6 +380,13 @@ namespace {
|
||||||
return entry.date();
|
return entry.date();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
value_t get_code(entry_t& entry) {
|
||||||
|
if (entry.code)
|
||||||
|
return string_value(*entry.code);
|
||||||
|
else
|
||||||
|
return string_value(empty_string);
|
||||||
|
}
|
||||||
|
|
||||||
value_t get_payee(entry_t& entry) {
|
value_t get_payee(entry_t& entry) {
|
||||||
return string_value(entry.payee);
|
return string_value(entry.payee);
|
||||||
}
|
}
|
||||||
|
|
@ -393,6 +400,11 @@ namespace {
|
||||||
expr_t::ptr_op_t entry_t::lookup(const string& name)
|
expr_t::ptr_op_t entry_t::lookup(const string& name)
|
||||||
{
|
{
|
||||||
switch (name[0]) {
|
switch (name[0]) {
|
||||||
|
case 'c':
|
||||||
|
if (name == "code")
|
||||||
|
return WRAP_FUNCTOR(get_wrapper<&get_code>);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
if (name[1] == '\0' || name == "date")
|
if (name[1] == '\0' || name == "date")
|
||||||
return WRAP_FUNCTOR(get_wrapper<&get_date>);
|
return WRAP_FUNCTOR(get_wrapper<&get_date>);
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,13 @@ namespace {
|
||||||
return xact.date();
|
return xact.date();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
value_t get_code(xact_t& xact) {
|
||||||
|
if (xact.entry->code)
|
||||||
|
return string_value(*xact.entry->code);
|
||||||
|
else
|
||||||
|
return string_value(empty_string);
|
||||||
|
}
|
||||||
|
|
||||||
value_t get_payee(xact_t& xact) {
|
value_t get_payee(xact_t& xact) {
|
||||||
return string_value(xact.entry->payee);
|
return string_value(xact.entry->payee);
|
||||||
}
|
}
|
||||||
|
|
@ -167,6 +174,8 @@ expr_t::ptr_op_t xact_t::lookup(const string& name)
|
||||||
case 'c':
|
case 'c':
|
||||||
if (name == "cleared")
|
if (name == "cleared")
|
||||||
return expr_t::op_t::wrap_value(0L);
|
return expr_t::op_t::wrap_value(0L);
|
||||||
|
else if (name == "code")
|
||||||
|
return WRAP_FUNCTOR(get_wrapper<&get_code>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue