From fb8be53edb9d9fdd91fd906e9a4ce6c3e8e3adb3 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 9 Nov 2009 01:24:44 -0500 Subject: Redesigned the format_t class --- src/exprbase.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/exprbase.h') diff --git a/src/exprbase.h b/src/exprbase.h index 605c30f7..d2bf5a6d 100644 --- a/src/exprbase.h +++ b/src/exprbase.h @@ -118,7 +118,8 @@ public: return str; } void set_text(const string& txt) { - str = txt; + str = txt; + compiled = false; } void parse(const string& str, const parse_flags_t& flags = PARSE_DEFAULT) { @@ -128,9 +129,7 @@ public: virtual void parse(std::istream&, const parse_flags_t& = PARSE_DEFAULT, const optional& original_string = none) { - str = original_string ? *original_string : ""; - context = NULL; - compiled = false; + set_text(original_string ? *original_string : ""); } void mark_uncompiled() { @@ -185,7 +184,9 @@ public: context = scope; } - virtual string context_to_str() const = 0; + virtual string context_to_str() const { + return empty_string; + } string print_to_str() const { std::ostringstream out; @@ -203,8 +204,8 @@ public: return out.str(); } - virtual void print(std::ostream& out) const = 0; - virtual void dump(std::ostream& out) const = 0; + virtual void print(std::ostream&) const {} + virtual void dump(std::ostream&) const {} result_type preview(std::ostream& out, scope_t& scope) const { out << _("--- Input expression ---") << std::endl; -- cgit v1.2.3