Get rid of FormatterBase::error_.

This commit is contained in:
Victor Zverovich
2014-08-28 07:48:55 -07:00
parent 279c7a6e6a
commit 56fc525e98
2 changed files with 28 additions and 35 deletions
+10 -5
View File
@@ -845,12 +845,11 @@ class FormatterBase {
protected:
ArgList args_;
int next_arg_index_;
const char *error_; // TODO: remove
FormatterBase() : error_(0) {}
const Arg &next_arg(const char *&error);
// Returns the argument with specified index or, if arg_index is equal
// to the maximum unsigned value, the next argument.
const Arg &handle_arg_index(unsigned arg_index);
template <typename Char>
@@ -866,10 +865,16 @@ class PrintfFormatter : private FormatterBase {
private:
void parse_flags(FormatSpec &spec, const Char *&s);
// Parses argument index, flags and width and returns the parsed
// argument index.
// Parses argument index, flags and width and returns the argument index.
unsigned parse_header(const Char *&s, FormatSpec &spec);
const Arg &get_arg(const Char *s,
unsigned arg_index = std::numeric_limits<unsigned>::max()) {
if (!*s)
throw FormatError("invalid format string");
return handle_arg_index(arg_index);
}
public:
void format(BasicWriter<Char> &writer,
BasicStringRef<Char> format, const ArgList &args);