diff options
-rw-r--r-- | src/report.cc | 19 | ||||
-rw-r--r-- | src/report.h | 1 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/report.cc b/src/report.cc index b2162034..09cae692 100644 --- a/src/report.cc +++ b/src/report.cc @@ -759,6 +759,23 @@ value_t report_t::fn_quoted(call_scope_t& args) return string_value(out.str()); } +value_t report_t::fn_quoted_rfc4180(call_scope_t& args) +{ + std::ostringstream out; + + out << '"'; + string arg(args.get<string>(0)); + foreach (const char ch, arg) { + if (ch == '"') + out << '"' << '"'; + else + out << ch; + } + out << '"'; + + return string_value(out.str()); +} + value_t report_t::fn_join(call_scope_t& args) { std::ostringstream out; @@ -1442,6 +1459,8 @@ expr_t::ptr_op_t report_t::lookup(const symbol_t::kind_t kind, case 'q': if (is_eq(p, "quoted")) return MAKE_FUNCTOR(report_t::fn_quoted); + else if (is_eq(p, "quoted_rfc4180")) + return MAKE_FUNCTOR(report_t::fn_quoted_rfc4180); else if (is_eq(p, "quantity")) return MAKE_FUNCTOR(report_t::fn_quantity); break; diff --git a/src/report.h b/src/report.h index e943de1d..6bd3ca73 100644 --- a/src/report.h +++ b/src/report.h @@ -181,6 +181,7 @@ public: value_t fn_abs(call_scope_t& scope); value_t fn_justify(call_scope_t& scope); value_t fn_quoted(call_scope_t& scope); + value_t fn_quoted_rfc4180(call_scope_t& scope); value_t fn_join(call_scope_t& scope); value_t fn_format_date(call_scope_t& scope); value_t fn_format_datetime(call_scope_t& scope); |