diff options
author | John Wiegley <johnw@newartisans.com> | 2008-08-01 03:44:22 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-08-01 03:44:22 -0400 |
commit | ea3b386062e62379c546239f2e95cb1e11c56d23 (patch) | |
tree | f200790541093b401b3a40af000a90daff7b6cb5 /format.cc | |
parent | 8ed99e621daccdebfe4fd81d9b3744ed1cdb375f (diff) | |
download | fork-ledger-ea3b386062e62379c546239f2e95cb1e11c56d23.tar.gz fork-ledger-ea3b386062e62379c546239f2e95cb1e11c56d23.tar.bz2 fork-ledger-ea3b386062e62379c546239f2e95cb1e11c56d23.zip |
Added a new 'format' debugging command, which dissects the formatting
expression in its argument.
Diffstat (limited to 'format.cc')
-rw-r--r-- | format.cc | 27 |
1 files changed, 26 insertions, 1 deletions
@@ -13,6 +13,31 @@ int format_t::abbrev_length = 2; bool format_t::ansi_codes = false; bool format_t::ansi_invert = false; +void format_t::element_t::dump(std::ostream& out) const +{ + out << "Element: "; + + switch (type) { + case STRING: out << " STRING"; break; + case EXPR: out << " EXPR"; break; + } + + out << " flags: " << int(flags); + out << " min: "; + out << std::right; + out.width(2); + out << int(min_width); + out << " max: "; + out << std::right; + out.width(2); + out << int(max_width); + + switch (type) { + case STRING: out << " str: '" << chars << "'" << std::endl; break; + case EXPR: out << " expr: " << expr << std::endl; break; + } +} + namespace { string partial_account_name(const account_t& account) { @@ -160,7 +185,7 @@ format_t::element_t * format_t::parse_elements(const string& fmt) default: current->type = element_t::EXPR; - current->expr.parse(string("format_") + *p); + current->expr.parse(string("fmt_") + *p); break; } } |