X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fformatter.h;fp=source%2Fformatter.h;h=cde508bac9740aaf9c0064166436b38354a3d7f4;hp=521dd559237bcc76943d0858a18315abed69ce85;hb=5b1368cb791cab043f0435628cacbaff36e39b7b;hpb=36f9e78ae75f5e14b132f37d249340ad3480b8ce diff --git a/source/formatter.h b/source/formatter.h index 521dd55..cde508b 100644 --- a/source/formatter.h +++ b/source/formatter.h @@ -18,29 +18,28 @@ Printf-like string formatter class. */ class Formatter { +private: + std::string fmt; + std::string::iterator pos; + std::string result; + public: Formatter(const std::string &); - /** - Extracts the next conversion from the format string and formats the given - value with it. Will throw if no more conversions are found. - */ + /** Extracts the next conversion from the format string and formats the + given value with it. Will throw if no more conversions are found. */ template Formatter &operator()(const T &a) { - result+=lexical_cast(a, get_conversion()); + result += lexical_cast(a, get_conversion()); advance(); return *this; } const std::string &str() const; private: - std::string fmt; - std::string::iterator pos; - std::string result; - void advance(); - Fmt get_conversion(); + Fmt get_conversion(); }; inline Formatter format(const std::string &f)