Added a helper method for setting expr options
Now one does:
parent->HANDLER(display_total_).set_expr("total");
Rather than what was required previously:
parent->HANDLER(display_total_).on("total");
parent->HANDLER(display_total_).expr = "total";
This commit is contained in:
parent
5fc1f9dce9
commit
3ef07ae39f
1 changed files with 26 additions and 14 deletions
40
src/report.h
40
src/report.h
|
|
@ -210,11 +210,14 @@ public:
|
||||||
(report_t, amount_, // -t
|
(report_t, amount_, // -t
|
||||||
expr_t expr;
|
expr_t expr;
|
||||||
CTOR(report_t, amount_) {
|
CTOR(report_t, amount_) {
|
||||||
expr = "amount";
|
set_expr("amount");
|
||||||
on("amount");
|
}
|
||||||
|
void set_expr(const string& str) {
|
||||||
|
expr = str;
|
||||||
|
on(str);
|
||||||
}
|
}
|
||||||
DO_(args) {
|
DO_(args) {
|
||||||
expr = args[0].to_string();
|
set_expr(args[0].to_string());
|
||||||
});
|
});
|
||||||
|
|
||||||
OPTION_(report_t, amount_data, DO() {
|
OPTION_(report_t, amount_data, DO() {
|
||||||
|
|
@ -291,22 +294,28 @@ public:
|
||||||
(report_t, display_amount_,
|
(report_t, display_amount_,
|
||||||
expr_t expr;
|
expr_t expr;
|
||||||
CTOR(report_t, display_amount_) {
|
CTOR(report_t, display_amount_) {
|
||||||
expr = "amount_expr";
|
set_expr("amount_expr");
|
||||||
on("amount_expr");
|
}
|
||||||
|
void set_expr(const string& str) {
|
||||||
|
expr = str;
|
||||||
|
on(str);
|
||||||
}
|
}
|
||||||
DO_(args) {
|
DO_(args) {
|
||||||
expr = args[0].to_string();
|
set_expr(args[0].to_string());
|
||||||
});
|
});
|
||||||
|
|
||||||
OPTION__
|
OPTION__
|
||||||
(report_t, display_total_,
|
(report_t, display_total_,
|
||||||
expr_t expr;
|
expr_t expr;
|
||||||
CTOR(report_t, display_total_) {
|
CTOR(report_t, display_total_) {
|
||||||
expr = "total_expr";
|
set_expr("total_expr");
|
||||||
on("total_expr");
|
}
|
||||||
|
void set_expr(const string& str) {
|
||||||
|
expr = str;
|
||||||
|
on(str);
|
||||||
}
|
}
|
||||||
DO_(args) {
|
DO_(args) {
|
||||||
expr = args[0].to_string();
|
set_expr(args[0].to_string());
|
||||||
});
|
});
|
||||||
|
|
||||||
OPTION(report_t, dow);
|
OPTION(report_t, dow);
|
||||||
|
|
@ -346,8 +355,8 @@ public:
|
||||||
|
|
||||||
OPTION_(report_t, market, DO() { // -V
|
OPTION_(report_t, market, DO() { // -V
|
||||||
parent->HANDLER(revalued).on();
|
parent->HANDLER(revalued).on();
|
||||||
parent->HANDLER(display_amount_).on("market_value(amount_expr)");
|
parent->HANDLER(display_amount_).set_expr("market_value(amount_expr)");
|
||||||
parent->HANDLER(display_total_).on("market_value(total_expr)");
|
parent->HANDLER(display_total_).set_expr("market_value(total_expr)");
|
||||||
});
|
});
|
||||||
|
|
||||||
OPTION_(report_t, monthly, DO() { // -M
|
OPTION_(report_t, monthly, DO() { // -M
|
||||||
|
|
@ -429,11 +438,14 @@ public:
|
||||||
(report_t, total_, // -T
|
(report_t, total_, // -T
|
||||||
expr_t expr;
|
expr_t expr;
|
||||||
CTOR(report_t, total_) {
|
CTOR(report_t, total_) {
|
||||||
expr = "total";
|
set_expr("total");
|
||||||
on("total");
|
}
|
||||||
|
void set_expr(const string& str) {
|
||||||
|
expr = str;
|
||||||
|
on(str);
|
||||||
}
|
}
|
||||||
DO_(args) {
|
DO_(args) {
|
||||||
expr = args[0].to_string();
|
set_expr(args[0].to_string());
|
||||||
});
|
});
|
||||||
|
|
||||||
OPTION_(report_t, total_data, DO() {
|
OPTION_(report_t, total_data, DO() {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue