formatting

master
Daniel Kolesa 2016-08-03 16:50:06 +01:00
parent d259877fba
commit 7a11157f95
2 changed files with 18 additions and 18 deletions

View File

@ -14,12 +14,12 @@ struct Foo {
template<typename R> template<typename R>
bool to_format(Foo const &, R &writer, FormatSpec const &fs) { bool to_format(Foo const &, R &writer, FormatSpec const &fs) {
switch (fs.spec()) { switch (fs.spec()) {
case 'i': case 'i':
writer.put_string("Foo1"); writer.put_string("Foo1");
break; break;
default: default:
writer.put_string("Foo2"); writer.put_string("Foo2");
break; break;
} }
return true; return true;
} }
@ -29,12 +29,12 @@ struct Bar {
template<typename R> template<typename R>
bool to_format(R &writer, FormatSpec const &fs) const { bool to_format(R &writer, FormatSpec const &fs) const {
switch (fs.spec()) { switch (fs.spec()) {
case 'i': case 'i':
writer.put_string("Bar1"); writer.put_string("Bar1");
break; break;
default: default:
writer.put_string("Bar2"); writer.put_string("Bar2");
break; break;
} }
return true; return true;
} }

View File

@ -30,12 +30,12 @@ namespace detail {
inline int parse_fmt_flags(ConstCharRange &fmt, int ret) { inline int parse_fmt_flags(ConstCharRange &fmt, int ret) {
while (!fmt.empty()) { while (!fmt.empty()) {
switch (fmt.front()) { switch (fmt.front()) {
case '-': ret |= FMT_FLAG_DASH; fmt.pop_front(); break; case '-': ret |= FMT_FLAG_DASH; fmt.pop_front(); break;
case '+': ret |= FMT_FLAG_PLUS; fmt.pop_front(); break; case '+': ret |= FMT_FLAG_PLUS; fmt.pop_front(); break;
case '#': ret |= FMT_FLAG_HASH; fmt.pop_front(); break; case '#': ret |= FMT_FLAG_HASH; fmt.pop_front(); break;
case '0': ret |= FMT_FLAG_ZERO; fmt.pop_front(); break; case '0': ret |= FMT_FLAG_ZERO; fmt.pop_front(); break;
case ' ': ret |= FMT_FLAG_SPACE; fmt.pop_front(); break; case ' ': ret |= FMT_FLAG_SPACE; fmt.pop_front(); break;
default: goto retflags; default: goto retflags;
} }
} }
retflags: retflags: