mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-26 00:21:13 +00:00
Get rid of the BasicFormatter::start_
This commit is contained in:
parent
69a0317590
commit
0eac037416
14
format.cc
14
format.cc
@ -1192,7 +1192,6 @@ const Char *fmt::BasicFormatter<Char>::format(
|
|||||||
|
|
||||||
if (*s++ != '}')
|
if (*s++ != '}')
|
||||||
FMT_THROW(FormatError("missing '}' in format string"));
|
FMT_THROW(FormatError("missing '}' in format string"));
|
||||||
start_ = s;
|
|
||||||
|
|
||||||
// Format argument.
|
// Format argument.
|
||||||
internal::ArgFormatter<Char>(*this, spec, s - 1).visit(arg);
|
internal::ArgFormatter<Char>(*this, spec, s - 1).visit(arg);
|
||||||
@ -1202,23 +1201,24 @@ const Char *fmt::BasicFormatter<Char>::format(
|
|||||||
template <typename Char>
|
template <typename Char>
|
||||||
void fmt::BasicFormatter<Char>::format(
|
void fmt::BasicFormatter<Char>::format(
|
||||||
BasicCStringRef<Char> format_str, const ArgList &args) {
|
BasicCStringRef<Char> format_str, const ArgList &args) {
|
||||||
const Char *s = start_ = format_str.c_str();
|
const Char *s = format_str.c_str();
|
||||||
|
const Char *start = s;
|
||||||
set_args(args);
|
set_args(args);
|
||||||
while (*s) {
|
while (*s) {
|
||||||
Char c = *s++;
|
Char c = *s++;
|
||||||
if (c != '{' && c != '}') continue;
|
if (c != '{' && c != '}') continue;
|
||||||
if (*s == c) {
|
if (*s == c) {
|
||||||
write(writer_, start_, s);
|
write(writer_, start, s);
|
||||||
start_ = ++s;
|
start = ++s;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (c == '}')
|
if (c == '}')
|
||||||
FMT_THROW(FormatError("unmatched '}' in format string"));
|
FMT_THROW(FormatError("unmatched '}' in format string"));
|
||||||
write(writer_, start_, s - 1);
|
write(writer_, start, s - 1);
|
||||||
Arg arg = is_name_start(*s) ? parse_arg_name(s) : parse_arg_index(s);
|
Arg arg = is_name_start(*s) ? parse_arg_name(s) : parse_arg_index(s);
|
||||||
s = format(s, arg);
|
start = s = format(s, arg);
|
||||||
}
|
}
|
||||||
write(writer_, start_, s);
|
write(writer_, start, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
FMT_FUNC void fmt::report_system_error(
|
FMT_FUNC void fmt::report_system_error(
|
||||||
|
1
format.h
1
format.h
@ -1326,7 +1326,6 @@ template <typename Char>
|
|||||||
class BasicFormatter : private internal::FormatterBase {
|
class BasicFormatter : private internal::FormatterBase {
|
||||||
private:
|
private:
|
||||||
BasicWriter<Char> &writer_;
|
BasicWriter<Char> &writer_;
|
||||||
const Char *start_;
|
|
||||||
internal::ArgMap<Char> map_;
|
internal::ArgMap<Char> map_;
|
||||||
|
|
||||||
FMT_DISALLOW_COPY_AND_ASSIGN(BasicFormatter);
|
FMT_DISALLOW_COPY_AND_ASSIGN(BasicFormatter);
|
||||||
|
Loading…
Reference in New Issue
Block a user