forked from OctaForge/libostd
formatting
This commit is contained in:
parent
d259877fba
commit
7a11157f95
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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:
|
||||||
|
|
Loading…
Reference in a new issue