X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fstrings%2Ffmt.h;h=3c1db9d3e3c37c14f76ad6a7cba166925f00a26f;hb=03862ac4f38db0799872850dc4ab43b88688e4eb;hp=baf2a76f9b96ae51e7cf7d845193f39fcbc8c9a5;hpb=dce2985e07e6184f000ef176451150710e21ee35;p=libs%2Fcore.git diff --git a/source/strings/fmt.h b/source/strings/fmt.h index baf2a76..3c1db9d 100644 --- a/source/strings/fmt.h +++ b/source/strings/fmt.h @@ -11,7 +11,7 @@ class format_error: public std::logic_error { public: format_error(const std::string &w): std::logic_error(w) { } - virtual ~format_error() throw() { } + virtual ~format_error() throw() = default; }; @@ -68,22 +68,22 @@ public: }; private: - unsigned wd; - unsigned prec; - bool spos; - wchar_t fillc; - Base base; - bool sbase; - FloatMode fmode; - bool spoint; - Align align; - bool ucase; - Type type; + unsigned wd = 0; + unsigned prec = 6; + bool spos = false; + wchar_t fillc = ' '; + Base base = DEC; + bool sbase = false; + FloatMode fmode = AUTOFLT; + bool spoint = false; + Align align = RIGHT; + bool ucase = false; + Type type = STR; public: - Fmt() { reset(); } - Fmt(const char *f) { reset(); parse(f); } - Fmt(const std::string &f) { reset(); parse(f.c_str()); } + Fmt() = default; + Fmt(const char *f) { parse(f); } + Fmt(const std::string &f) { parse(f.c_str()); } private: void parse(const char *); @@ -103,6 +103,7 @@ public: Fmt &hex() { base = HEX; return *this; } Fmt &oct() { base = OCT; return *this; } Fmt &bin() { base = BIN; return *this; } + Fmt &autobase() { base = AUTOBASE; return *this; } Fmt &uppercase(bool u = true) { ucase = u; return *this; } Fmt &numeric() { type = NUM; return *this; } Fmt &character() { type = CHAR; return *this; }