summaryrefslogtreecommitdiff
path: root/format.h
diff options
context:
space:
mode:
Diffstat (limited to 'format.h')
-rw-r--r--format.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/format.h b/format.h
index 7fc46985..c61518be 100644
--- a/format.h
+++ b/format.h
@@ -54,13 +54,19 @@ struct format_t
static std::auto_ptr<node_t> value_expr;
static std::auto_ptr<node_t> total_expr;
- format_t(const std::string& _format) {
- elements = parse_elements(_format);
+ format_t(const std::string& _format) : elements(NULL) {
+ reset(_format);
}
~format_t() {
if (elements) delete elements;
}
+ void reset(const std::string& _format) {
+ if (elements)
+ delete elements;
+ elements = parse_elements(_format);
+ }
+
static element_t * parse_elements(const std::string& fmt);
void format_elements(std::ostream& out, const details_t& details) const;