summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-10-28 18:38:33 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-10-28 18:38:33 -0400
commit2aef4f8884d96375a506f90fe163d90d6346b43c (patch)
treeb8ab51fcc823613b95902c353f471c2afee1197f /src
parent1c9c3ad411356ac45e9c25b6d21331b3c4d14174 (diff)
downloadfork-ledger-2aef4f8884d96375a506f90fe163d90d6346b43c.tar.gz
fork-ledger-2aef4f8884d96375a506f90fe163d90d6346b43c.tar.bz2
fork-ledger-2aef4f8884d96375a506f90fe163d90d6346b43c.zip
Render an expr if expr_t::text() has no string
Diffstat (limited to 'src')
-rw-r--r--src/expr.cc10
-rw-r--r--src/expr.h5
2 files changed, 11 insertions, 4 deletions
diff --git a/src/expr.cc b/src/expr.cc
index 89214d51..4f12a648 100644
--- a/src/expr.cc
+++ b/src/expr.cc
@@ -78,6 +78,16 @@ expr_t::ptr_op_t expr_t::get_op() throw()
return ptr;
}
+string expr_t::text()
+{
+ if (str.empty()) {
+ std::ostringstream out;
+ ptr->print(out);
+ set_text(out.str());
+ }
+ return str;
+}
+
expr_t& expr_t::operator=(const expr_t& _expr)
{
if (this != &_expr) {
diff --git a/src/expr.h b/src/expr.h
index 24276cd1..b880fd79 100644
--- a/src/expr.h
+++ b/src/expr.h
@@ -116,10 +116,7 @@ public:
}
ptr_op_t get_op() throw();
-
- string text() const throw() {
- return str;
- }
+ string text();
// This has special use in the textual parser
void set_text(const string& txt) {