diff options
author | John Wiegley <johnw@newartisans.com> | 2004-08-22 02:40:18 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2004-08-22 02:40:18 -0400 |
commit | 02168c782364a1a8641b4bed7ebf4a84cb6b3560 (patch) | |
tree | f3e31f99245871413587d3eb0ad1fa5974bf9558 /format.cc | |
parent | 5619a1d5be144877df8cce01c40ff668bbb0c96a (diff) | |
download | fork-ledger-02168c782364a1a8641b4bed7ebf4a84cb6b3560.tar.gz fork-ledger-02168c782364a1a8641b4bed7ebf4a84cb6b3560.tar.bz2 fork-ledger-02168c782364a1a8641b4bed7ebf4a84cb6b3560.zip |
escape codes in format strings; can now redefine individual report formats
Diffstat (limited to 'format.cc')
-rw-r--r-- | format.cc | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -53,7 +53,7 @@ element_t * format_t::parse_elements(const std::string& fmt) char * q = buf; for (const char * p = fmt.c_str(); *p; p++) { - if (*p != '%') { + if (*p != '%' && *p != '\\') { *q++ = *p; continue; } @@ -75,6 +75,20 @@ element_t * format_t::parse_elements(const std::string& fmt) current = current->next; } + if (*p == '\\') { + p++; + current->type = element_t::STRING; + switch (*p) { + case 'b': current->chars = "\b"; break; + case 'f': current->chars = "\f"; break; + case 'n': current->chars = "\n"; break; + case 'r': current->chars = "\r"; break; + case 't': current->chars = "\t"; break; + case 'v': current->chars = "\v"; break; + } + continue; + } + ++p; if (*p == '-') { current->align_left = true; |