Parse printf format specs.

This commit is contained in:
Victor Zverovich
2014-06-19 07:40:35 -07:00
parent 7d5da66db9
commit cb743c0249
3 changed files with 99 additions and 92 deletions
+10 -3
View File
@@ -884,7 +884,9 @@ class BasicWriter {
enum Type {
// Numeric types should go first.
INT, UINT, LONG, ULONG, LONG_LONG, ULONG_LONG, DOUBLE, LONG_DOUBLE,
INT, UINT, LONG, ULONG, LONG_LONG, ULONG_LONG,
LAST_INTEGER_TYPE = ULONG_LONG,
DOUBLE, LONG_DOUBLE,
LAST_NUMERIC_TYPE = LONG_DOUBLE,
CHAR, STRING, WSTRING, POINTER, CUSTOM
};
@@ -1043,8 +1045,13 @@ class BasicWriter {
const ArgInfo *args_;
int next_arg_index_;
unsigned HandleArgIndex(unsigned arg_index, const char *&error);
void ParseFlags(FormatSpec &spec, const Char *&s, const ArgInfo &arg);
void ParseFlags(FormatSpec &spec, const Char *&s);
// Parses argument index, flags and width and returns the parsed
// argument index.
unsigned ParseHeader(const Char *&s, FormatSpec &spec, const char *&error);
const ArgInfo &HandleArgIndex(unsigned arg_index, const char *&error);
public:
void Format(BasicWriter<Char> &writer,