]> git.tdb.fi Git - libs/core.git/blobdiff - source/fmt.cpp
core/error.h renamed to except.h
[libs/core.git] / source / fmt.cpp
index c9f5d6c70eac16ff071acaf9208d9001925f2993..fdd73f3c43b726175f927fe4d0ade866db577315 100644 (file)
@@ -1,4 +1,10 @@
-#include <msp/error.h>
+/* $Id$
+
+This file is part of libmspstrings
+Copyright © 2006-2007 Mikko Rasa
+Distributed under the LGPL
+*/
+#include <msp/core/except.h>
 #include "fmt.h"
 
 using namespace std;
@@ -32,7 +38,7 @@ void Fmt::apply(ostream &out) const
 {
        out.flags(((base==HEX) ? ios_base::hex : (base==OCT) ? ios_base::oct : ios_base::dec)
                | ((fmode==SCI) ? ios_base::scientific : (fmode==FIXED) ? ios_base::fixed : ios_base::fmtflags(0))
-               | (fillc ? ios_base::internal : (align==LEFT) ? ios_base::left : ios_base::right)
+               | (fillc=='0' ? ios_base::internal : (align==LEFT) ? ios_base::left : ios_base::right)
                | (sbase ? ios_base::showbase : ios_base::fmtflags(0))
                | (spoint ? ios_base::showpoint : ios_base::fmtflags(0))
                | (spos ? ios_base::showpos : ios_base::fmtflags(0))
@@ -93,11 +99,11 @@ void Fmt::parse(const char *f)
        else if(*f=='o')
                base=OCT;
        else if(*f=='e' || *f=='E')
-               fmode=EXP;
+               fmode=SCI;
        else if(*f=='f' || *f=='F')
                fmode=FIXED;
        else if(*f=='g' || *f=='G')
-               fmode=SCI;
+               fmode=EXP;
        else if(*f=='p')
        {
                base=HEX;