diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-15 15:46:03 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-15 15:46:03 -0400 |
commit | 3ef07ae39f83203738846e36523cef938a70288f (patch) | |
tree | ed48211aaa78786b2962a89cc6bc2eb5e2ba921d /src | |
parent | 5fc1f9dce96379e210c8cb4c553b1094f589d42b (diff) | |
download | fork-ledger-3ef07ae39f83203738846e36523cef938a70288f.tar.gz fork-ledger-3ef07ae39f83203738846e36523cef938a70288f.tar.bz2 fork-ledger-3ef07ae39f83203738846e36523cef938a70288f.zip |
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";
Diffstat (limited to 'src')
-rw-r--r-- | src/report.h | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/src/report.h b/src/report.h index ccc0e231..6216f369 100644 --- a/src/report.h +++ b/src/report.h @@ -210,11 +210,14 @@ public: (report_t, amount_, // -t expr_t expr; CTOR(report_t, amount_) { - expr = "amount"; - on("amount"); + set_expr("amount"); + } + void set_expr(const string& str) { + expr = str; + on(str); } DO_(args) { - expr = args[0].to_string(); + set_expr(args[0].to_string()); }); OPTION_(report_t, amount_data, DO() { @@ -291,22 +294,28 @@ public: (report_t, display_amount_, expr_t expr; CTOR(report_t, display_amount_) { - expr = "amount_expr"; - on("amount_expr"); + set_expr("amount_expr"); + } + void set_expr(const string& str) { + expr = str; + on(str); } DO_(args) { - expr = args[0].to_string(); + set_expr(args[0].to_string()); }); OPTION__ (report_t, display_total_, expr_t expr; CTOR(report_t, display_total_) { - expr = "total_expr"; - on("total_expr"); + set_expr("total_expr"); + } + void set_expr(const string& str) { + expr = str; + on(str); } DO_(args) { - expr = args[0].to_string(); + set_expr(args[0].to_string()); }); OPTION(report_t, dow); @@ -346,8 +355,8 @@ public: OPTION_(report_t, market, DO() { // -V parent->HANDLER(revalued).on(); - parent->HANDLER(display_amount_).on("market_value(amount_expr)"); - parent->HANDLER(display_total_).on("market_value(total_expr)"); + parent->HANDLER(display_amount_).set_expr("market_value(amount_expr)"); + parent->HANDLER(display_total_).set_expr("market_value(total_expr)"); }); OPTION_(report_t, monthly, DO() { // -M @@ -429,11 +438,14 @@ public: (report_t, total_, // -T expr_t expr; CTOR(report_t, total_) { - expr = "total"; - on("total"); + set_expr("total"); + } + void set_expr(const string& str) { + expr = str; + on(str); } DO_(args) { - expr = args[0].to_string(); + set_expr(args[0].to_string()); }); OPTION_(report_t, total_data, DO() { |