X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fstrings%2Ffmt.cpp;h=07484dd61c7fe27d514ee4a325e1d2fe7bbe366d;hp=e06f71ab456f40d55825345ea413bc6981d10dd6;hb=faeafc9d652ba6caa350ca95dff14408b036ccfb;hpb=b56eb5ec1da675da0c66abc53c1e4f6c4e4cccbd diff --git a/source/strings/fmt.cpp b/source/strings/fmt.cpp index e06f71a..07484dd 100644 --- a/source/strings/fmt.cpp +++ b/source/strings/fmt.cpp @@ -1,19 +1,12 @@ -/* $Id$ - -This file is part of libmspstrings -Copyright © 2006-2008 Mikko Rasa -Distributed under the LGPL -*/ - -#include #include "fmt.h" using namespace std; namespace Msp { -void Fmt::parse(const char *f) +void Fmt::parse(const char *s) { + const char *f = s; if(*f=='%') ++f; for(; *f; ++f) @@ -33,6 +26,9 @@ void Fmt::parse(const char *f) break; } + if(align==LEFT) + fillc = ' '; + wd = 0; for(; *f; ++f) { @@ -82,7 +78,7 @@ void Fmt::parse(const char *f) else if(*f=='i') base = AUTOBASE; else - throw InvalidParameterValue("Invalid conversion specifier"); + throw format_error(s); if(*f=='E' || *f=='F' || *f=='G' || *f=='X' || *f=='P') ucase = true; @@ -90,7 +86,7 @@ void Fmt::parse(const char *f) ++f; if(*f) - throw InvalidParameterValue("Extra characters in conversion specification"); + throw format_error(s); } Fmt &Fmt::reset()