A little bit of code cleanup

This commit is contained in:
John Wiegley 2010-06-04 02:23:04 -04:00
parent 45451125e3
commit 946534b102
5 changed files with 29 additions and 20 deletions

View file

@ -62,7 +62,6 @@ namespace ledger {
class commodity_t;
class annotation_t;
class keep_details_t;
class commodity_pool_t;
DECLARE_EXCEPTION(amount_error, std::runtime_error);
@ -514,7 +513,7 @@ public:
amount's commodity:
commodity() returns an amount's commodity. If the amount has no
commodity, the value returned is `current_pool->null_commodity'.
commodity, the value returned is the `null_commodity'.
has_commodity() returns true if the amount has a commodity.

View file

@ -50,6 +50,7 @@
namespace ledger {
class keep_details_t;
class commodity_pool_t;
DECLARE_EXCEPTION(commodity_error, std::runtime_error);

View file

@ -1318,9 +1318,10 @@ expr_t::ptr_op_t report_t::lookup(const symbol_t::kind_t kind,
case symbol_t::COMMAND:
switch (*p) {
case 'a':
if (is_eq(p, "accounts"))
if (is_eq(p, "accounts")) {
return WRAP_FUNCTOR(reporter<>(new report_accounts(*this), *this,
"#accounts"));
}
break;
case 'b':
@ -1381,48 +1382,57 @@ expr_t::ptr_op_t report_t::lookup(const symbol_t::kind_t kind,
HANDLER(print_virtual).on_only(string("#equity"));
return WRAP_FUNCTOR(reporter<>(new print_xacts(*this), *this, "#equity"));
}
else if (is_eq(p, "entry"))
else if (is_eq(p, "entry")) {
return WRAP_FUNCTOR(xact_command);
else if (is_eq(p, "emacs"))
}
else if (is_eq(p, "emacs")) {
return WRAP_FUNCTOR
(reporter<>(new format_emacs_posts(output_stream), *this, "#emacs"));
else if (is_eq(p, "echo"))
}
else if (is_eq(p, "echo")) {
return MAKE_FUNCTOR(report_t::echo_command);
}
break;
case 'p':
if (*(p + 1) == '\0' || is_eq(p, "print"))
if (*(p + 1) == '\0' || is_eq(p, "print")) {
return WRAP_FUNCTOR
(reporter<>(new print_xacts(*this, HANDLED(raw)), *this, "#print"));
else if (is_eq(p, "prices"))
}
else if (is_eq(p, "prices")) {
return expr_t::op_t::wrap_functor
(reporter<post_t, post_handler_ptr, &report_t::commodities_report>
(new format_posts(*this, report_format(HANDLER(prices_format_)),
maybe_format(HANDLER(prepend_format_)),
HANDLER(prepend_width_).value.to_long()),
*this, "#prices"));
else if (is_eq(p, "pricedb"))
}
else if (is_eq(p, "pricedb")) {
return expr_t::op_t::wrap_functor
(reporter<post_t, post_handler_ptr, &report_t::commodities_report>
(new format_posts(*this, report_format(HANDLER(pricedb_format_)),
maybe_format(HANDLER(prepend_format_)),
HANDLER(prepend_width_).value.to_long()),
*this, "#pricedb"));
else if (is_eq(p, "payees"))
}
else if (is_eq(p, "payees")) {
return WRAP_FUNCTOR(reporter<>(new report_payees(*this), *this,
"#payees"));
}
break;
case 'r':
if (*(p + 1) == '\0' || is_eq(p, "reg") || is_eq(p, "register"))
if (*(p + 1) == '\0' || is_eq(p, "reg") || is_eq(p, "register")) {
return WRAP_FUNCTOR
(reporter<>
(new format_posts(*this, report_format(HANDLER(register_format_)),
maybe_format(HANDLER(prepend_format_)),
HANDLER(prepend_width_).value.to_long()),
*this, "#register"));
else if (is_eq(p, "reload"))
}
else if (is_eq(p, "reload")) {
return MAKE_FUNCTOR(report_t::reload_command);
}
break;
case 's':

View file

@ -50,7 +50,6 @@
namespace ledger {
class commodity_pool_t;
class xact_t;
class session_t : public symbol_scope_t

View file

@ -2,18 +2,18 @@
<<<
>>>1
>>>2
While parsing file "$sourcepath/src/amount.h", line 67:
While parsing file "$sourcepath/src/amount.h", line 66:
Error: No quantity specified for amount
While parsing file "$sourcepath/src/amount.h", line 721:
While parsing file "$sourcepath/src/amount.h", line 720:
Error: Invalid date/time: line amount_t amoun
While parsing file "$sourcepath/src/amount.h", line 727:
While parsing file "$sourcepath/src/amount.h", line 726:
Error: Invalid date/time: line string amount_
While parsing file "$sourcepath/src/amount.h", line 733:
While parsing file "$sourcepath/src/amount.h", line 732:
Error: Invalid date/time: line string amount_
While parsing file "$sourcepath/src/amount.h", line 739:
While parsing file "$sourcepath/src/amount.h", line 738:
Error: Invalid date/time: line string amount_
While parsing file "$sourcepath/src/amount.h", line 745:
While parsing file "$sourcepath/src/amount.h", line 744:
Error: Invalid date/time: line std::ostream&
While parsing file "$sourcepath/src/amount.h", line 752:
While parsing file "$sourcepath/src/amount.h", line 751:
Error: Invalid date/time: line std::istream&
=== 7