29#ifndef __BASE_CPRINTF_FORMATS_HH__
30#define __BASE_CPRINTF_FORMATS_HH__
108 std::ios::fmtflags
flags(out.flags());
112 out.setf(std::ios::hex, std::ios::basefield);
116 out.setf(std::ios::oct, std::ios::basefield);
120 out.setf(std::ios::dec, std::ios::basefield);
126 out.setf(std::ios::showbase);
147 out.width(fmt.
width);
150 out.setf(std::ios::left);
153 out.setf(std::ios::showpos);
156 out.setf(std::ios::uppercase);
167 std::ios::fmtflags
flags(out.flags());
176 out.width(fmt.
width);
181 out.setf(std::ios::scientific);
184 }
else if (fmt.
width > 0) {
185 out.width(fmt.
width);
189 out.setf(std::ios::uppercase);
195 out.width(fmt.
width);
197 out.setf(std::ios::fixed);
199 }
else if (fmt.
width > 0) {
200 out.width(fmt.
width);
210 out.width(fmt.
width);
225 std::stringstream foo;
227 int flen = foo.str().size();
229 if (fmt.
width > flen) {
230 char spaces[fmt.
width - flen + 1];
231 std::memset(spaces,
' ', fmt.
width - flen);
232 spaces[fmt.
width - flen] = 0;
235 out << foo.str() << spaces;
237 out << spaces << foo.str();
258 out <<
"<bad arg type for char format>";
369 out <<
"<bad arg type for float format>";
static void _formatChar(std::ostream &out, const T &data, Format &fmt)
static void formatChar(std::ostream &out, const T &data, Format &fmt)
static void _formatInteger(std::ostream &out, const T &data, Format &fmt)
static void _formatFloat(std::ostream &out, const T &data, Format &fmt)
static void formatInteger(std::ostream &out, const T &data, Format &fmt)
static void _formatString(std::ostream &out, const T &data, Format &fmt)
static void formatString(std::ostream &out, const T &data, Format &fmt)
static void formatFloat(std::ostream &out, const T &data, Format &fmt)
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....