+/* $Id$
+
+This file is part of libmspstrings
+Copyright © 2006-2007 Mikko Rasa
+Distributed under the LGPL
+*/
+
#ifndef MSP_STRINGS_FORMATTER_H_
#define MSP_STRINGS_FORMATTER_H_
*/
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<typename T>
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)