summaryrefslogtreecommitdiff
path: root/format.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2008-08-01 03:44:22 -0400
committerJohn Wiegley <johnw@newartisans.com>2008-08-01 03:44:22 -0400
commitea3b386062e62379c546239f2e95cb1e11c56d23 (patch)
treef200790541093b401b3a40af000a90daff7b6cb5 /format.h
parent8ed99e621daccdebfe4fd81d9b3744ed1cdb375f (diff)
downloadledger-ea3b386062e62379c546239f2e95cb1e11c56d23.tar.gz
ledger-ea3b386062e62379c546239f2e95cb1e11c56d23.tar.bz2
ledger-ea3b386062e62379c546239f2e95cb1e11c56d23.zip
Added a new 'format' debugging command, which dissects the formatting
expression in its argument.
Diffstat (limited to 'format.h')
-rw-r--r--format.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/format.h b/format.h
index ebff2a65..3aa82fec 100644
--- a/format.h
+++ b/format.h
@@ -34,11 +34,11 @@ class format_t : public noncopyable
scoped_ptr<struct element_t> next;
- element_t()
+ element_t() throw()
: type(STRING), flags(false), min_width(0), max_width(0) {
TRACE_CTOR(element_t, "");
}
- ~element_t() {
+ ~element_t() throw() {
TRACE_DTOR(element_t);
}
@@ -55,6 +55,8 @@ class format_t : public noncopyable
if (elem->min_width > 0)
out.width(elem->min_width);
}
+
+ void dump(std::ostream& out) const;
};
string format_string;
@@ -92,6 +94,13 @@ public:
void format(std::ostream& out, scope_t& scope) const;
+ void dump(std::ostream& out) const {
+ for (const element_t * elem = elements.get();
+ elem;
+ elem = elem->next.get())
+ elem->dump(out);
+ }
+
private:
static element_t * parse_elements(const string& fmt);