summaryrefslogtreecommitdiff
path: root/src/report.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-10-31 04:17:40 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-10-31 04:17:40 -0400
commit97a9b42b2c5ef908e0c47ecfd39771a79f8fa8a2 (patch)
tree8eadb82cc54e66353e05309fe42c2900b93628bf /src/report.cc
parenta2cb549b1dff9024e3f700203e424e496b25fd91 (diff)
parenta0a980b9f4ebf1493682ecf1eb745bf52649aac5 (diff)
downloadfork-ledger-97a9b42b2c5ef908e0c47ecfd39771a79f8fa8a2.tar.gz
fork-ledger-97a9b42b2c5ef908e0c47ecfd39771a79f8fa8a2.tar.bz2
fork-ledger-97a9b42b2c5ef908e0c47ecfd39771a79f8fa8a2.zip
Merge branch 'next'
Diffstat (limited to 'src/report.cc')
-rw-r--r--src/report.cc42
1 files changed, 38 insertions, 4 deletions
diff --git a/src/report.cc b/src/report.cc
index bc0680d1..096536c9 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -235,12 +235,13 @@ value_t report_t::fn_justify(call_scope_t& scope)
return string_value(out.str());
}
-value_t report_t::fn_quoted(call_scope_t& args)
+value_t report_t::fn_quoted(call_scope_t& scope)
{
+ interactive_t args(scope, "s");
std::ostringstream out;
out << '"';
- foreach (const char ch, args[0].to_string()) {
+ foreach (const char ch, args.get<string>(0)) {
if (ch == '"')
out << "\\\"";
else
@@ -253,8 +254,7 @@ value_t report_t::fn_quoted(call_scope_t& args)
value_t report_t::fn_join(call_scope_t& scope)
{
- interactive_t args(scope, "s");
-
+ interactive_t args(scope, "s");
std::ostringstream out;
foreach (const char ch, args.get<string>(0)) {
@@ -315,6 +315,39 @@ value_t report_t::fn_price(call_scope_t& scope)
return args.value_at(0).price();
}
+value_t report_t::fn_lot_date(call_scope_t& scope)
+{
+ interactive_t args(scope, "v");
+ if (args.value_at(0).is_annotated()) {
+ const annotation_t& details(args.value_at(0).annotation());
+ if (details.date)
+ return *details.date;
+ }
+ return NULL_VALUE;
+}
+
+value_t report_t::fn_lot_price(call_scope_t& scope)
+{
+ interactive_t args(scope, "v");
+ if (args.value_at(0).is_annotated()) {
+ const annotation_t& details(args.value_at(0).annotation());
+ if (details.price)
+ return *details.price;
+ }
+ return NULL_VALUE;
+}
+
+value_t report_t::fn_lot_tag(call_scope_t& scope)
+{
+ interactive_t args(scope, "v");
+ if (args.value_at(0).is_annotated()) {
+ const annotation_t& details(args.value_at(0).annotation());
+ if (details.tag)
+ return string_value(*details.tag);
+ }
+ return NULL_VALUE;
+}
+
namespace {
value_t fn_black(call_scope_t&) {
return string_value("black");
@@ -559,6 +592,7 @@ option_t<report_t> * report_t::lookup_option(const char * p)
case 'f':
OPT(flat);
else OPT_ALT(forecast_while_, forecast_);
+ else OPT(forecast_years_);
else OPT(format_);
else OPT(force_color);
else OPT(force_pager);