69template <
typename ResultType>
112 return !
str.empty();
125 std::istringstream stream(
expr_str);
160 DEBUG(
"expr.compile",
"Before compilation:");
165 DEBUG(
"expr.compile",
"Compiling: " <<
str);
170 DEBUG(
"expr.compile",
"After compilation:");
176 DEBUG(
"expr.calc",
"Calculating: " <<
str);
197 std::ostringstream out;
202 std::ostringstream out;
207 std::ostringstream out;
212 virtual void print(std::ostream&)
const {}
213 virtual void dump(std::ostream&)
const {}
216 out <<
_(
"--- Input expression ---") << std::endl;
217 out <<
text() << std::endl;
219 out << std::endl <<
_(
"--- Text as parsed ---") << std::endl;
223 out << std::endl <<
_(
"--- Expression tree ---") << std::endl;
226 out << std::endl <<
_(
"--- Compiled tree ---") << std::endl;
230 out << std::endl <<
_(
"--- Result value ---") << std::endl;
235template <
typename ResultType>
General utility facilities used by Ledger.
#define TRACE_CTOR(cls, args)
Basic type for handling commoditized math: amount_t.
#define DECLARE_EXCEPTION(name, kind)
std::ostream & operator<<(std::ostream &out, const account_t &account)
string preview_to_str(scope_t &) const
virtual void parse(std::istream &, const parse_flags_t &=PARSE_DEFAULT, const optional< string > &original_string=none)
void recompile(scope_t &scope)
function< result_type(call_scope_t &) func_t)
void set_context(scope_t *scope)
result_type calc(scope_t &scope)
expr_base_t & operator=(const expr_base_t &_expr)
expr_base_t(scope_t *_context=NULL)
virtual void dump(std::ostream &) const
virtual result_type real_calc(scope_t &scope)=0
virtual string context_to_str() const
virtual void mark_uncompiled()
string print_to_str() const
result_type operator()(scope_t &scope)
result_type preview(std::ostream &out, scope_t &scope) const
virtual string text() const
string dump_to_str() const
expr_base_t(const expr_base_t &other)
virtual void print(std::ostream &) const
void set_text(const string &txt)
virtual void compile(scope_t &scope)
expr_base_t & operator=(const string &_expr)
void parse(const string &expr_str, const parse_flags_t &flags=PARSE_DEFAULT)