-/* $Id$
-
-This file is part of libmspstrings
-Copyright © 2006-2007 Mikko Rasa
-Distributed under the LGPL
-*/
-
#include "format.h"
using namespace std;
advance();
}
-/**
-Returns the result of the formatting operation. Will throw if not enough
-values have been fed to the formatter.
-*/
+Formatter::Formatter(const Formatter &other):
+ fmt(other.fmt),
+ pos(fmt.begin()+(other.pos-other.fmt.begin())),
+ result(other.result)
+{ }
+
+Formatter &Formatter::operator=(const Formatter &other)
+{
+ fmt = other.fmt;
+ pos = fmt.begin()+(other.pos-other.fmt.begin());
+ result = other.result;
+ return *this;
+}
+
const string &Formatter::str() const
{
if(pos!=fmt.end())
return result;
}
-/**
-Advances the pos 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 Formatter::advance()
{
for(; pos!=fmt.end(); ++pos)
}
}
-/**
-Reads the next conversion from the format string and returns a corresponding
-Fmt object.
-*/
Fmt Formatter::get_conversion()
{
if(pos==fmt.end())