3 This file is part of libmspstrings
4 Copyright © 2006-2007 Mikko Rasa
5 Distributed under the LGPL
16 Resets the format to the default. Mainly used by constructors.
35 Applies the format to the given ostream. All existing formatting information
38 void Fmt::apply(ostream &out) const
40 out.flags(((base==HEX) ? ios_base::hex : (base==OCT) ? ios_base::oct : ios_base::dec)
41 | ((fmode==SCI) ? ios_base::scientific : (fmode==FIXED) ? ios_base::fixed : ios_base::fmtflags(0))
42 | (fillc=='0' ? ios_base::internal : (align==LEFT) ? ios_base::left : ios_base::right)
43 | (sbase ? ios_base::showbase : ios_base::fmtflags(0))
44 | (spoint ? ios_base::showpoint : ios_base::fmtflags(0))
45 | (spos ? ios_base::showpos : ios_base::fmtflags(0))
46 | (ucase ? ios_base::uppercase : ios_base::fmtflags(0)));
53 Parses a printf-style conversion specification. Called from constructors.
55 void Fmt::parse(const char *f)
79 if(*f>='0' && *f<='9')
91 if(*f>='0' && *f<='9')
92 prec=prec*10+(*f-'0');
98 if(*f=='x' || *f=='X')
102 else if(*f=='e' || *f=='E')
104 else if(*f=='f' || *f=='F')
106 else if(*f=='g' || *f=='G')
113 else if(*f=='d' || *f=='i' || *f=='u' || *f=='c' || *f=='s')
116 throw InvalidParameterValue("Invalid conversion specifier");
118 if(*f=='E' || *f=='F' || *f=='G' || *f=='X')
124 throw InvalidParameterValue("Extra characters in conversion specification");