-/* $Id$
-
-This file is part of libmspstrings
-Copyright © 2006-2007 Mikko Rasa
-Distributed under the LGPL
-*/
-
#ifndef MSP_STRINGS_FORMAT_H_
#define MSP_STRINGS_FORMAT_H_
template<typename T>
Formatter &operator()(const T &a)
{
- result += lexical_cast(a, get_conversion());
+ result += lexical_cast<std::string>(a, get_conversion());
advance();
return *this;
}
+ /** Returns the result of the formatting operation. Will throw if not
+ enough values have been fed to the formatter. */
const std::string &str() const;
+
private:
+ /** Advances the iterator to the next conversion, adding literal characters
+ to the result. The iterator is left at the second character of the
+ conversion (i.e. after the %). */
void advance();
+
+ /** Reads the next conversion from the format string and returns a
+ corresponding Fmt object. */
Fmt get_conversion();
};