diff options
author | John Wiegley <johnw@newartisans.com> | 2009-11-09 01:24:44 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-11-09 02:06:08 -0500 |
commit | fb8be53edb9d9fdd91fd906e9a4ce6c3e8e3adb3 (patch) | |
tree | e1e41cd4e926ad108743f29158b4ef8e451b90f5 /src/exprbase.h | |
parent | c3535d06c89732a0ba4c13274702b0f48198ae79 (diff) | |
download | fork-ledger-fb8be53edb9d9fdd91fd906e9a4ce6c3e8e3adb3.tar.gz fork-ledger-fb8be53edb9d9fdd91fd906e9a4ce6c3e8e3adb3.tar.bz2 fork-ledger-fb8be53edb9d9fdd91fd906e9a4ce6c3e8e3adb3.zip |
Redesigned the format_t class
Diffstat (limited to 'src/exprbase.h')
-rw-r--r-- | src/exprbase.h | 15 |
1 files changed, 8 insertions, 7 deletions
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<string>& original_string = none) { - str = original_string ? *original_string : "<stream>"; - context = NULL; - compiled = false; + set_text(original_string ? *original_string : "<stream>"); } 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; |