31 #ifndef __BASE_CPRINTF_FORMATS_HH__ 32 #define __BASE_CPRINTF_FORMATS_HH__ 60 alternate_form =
false;
71 get_precision =
false;
91 ios::fmtflags flags(out.flags());
95 out.setf(std::ios::hex, std::ios::basefield);
99 out.setf(std::ios::oct, std::ios::basefield);
103 out.setf(std::ios::dec, std::ios::basefield);
109 out.setf(std::ios::showbase);
130 out.width(fmt.
width);
133 out.setf(std::ios::left);
136 out.setf(std::ios::showpos);
139 out.setf(std::ios::uppercase);
146 template <
typename T>
152 ios::fmtflags flags(out.flags());
161 out.width(fmt.
width);
166 out.setf(std::ios::scientific);
171 out.width(fmt.
width);
174 out.setf(std::ios::uppercase);
180 out.width(fmt.
width);
182 out.setf(std::ios::fixed);
186 out.width(fmt.
width);
195 out.width(fmt.
width);
205 template <
typename T>
211 #if defined(__GNUC__) && (__GNUC__ < 3) || 1 213 std::stringstream foo;
215 int flen = foo.str().size();
217 if (fmt.
width > flen) {
218 char *spaces =
new char[fmt.
width - flen + 1];
219 memset(spaces,
' ', fmt.
width - flen);
220 spaces[fmt.
width - flen] = 0;
223 out << foo.str() << spaces;
225 out << spaces << foo.str();
234 out.width(fmt.
width);
236 out.setf(std::ios::left);
250 template <
typename T>
253 { out <<
"<bad arg type for char format>"; }
302 template <
typename T>
325 template <
typename T>
328 { out <<
"<bad arg type for float format>"; }
341 template <
typename T>
348 #endif // __CPRINTF_FORMATS_HH__ void _format_float(std::ostream &out, const T &data, Format &fmt)
void _format_integer(std::ostream &out, const T &data, Format &fmt)
Overload hash function for BasicBlockRange type.
void format_string(std::ostream &out, const T &data, Format &fmt)
void format_float(std::ostream &out, const T &data, Format &fmt)
void format_integer(std::ostream &out, const T &data, Format &fmt)
void _format_char(std::ostream &out, const T &data, Format &fmt)
void format_char(std::ostream &out, const T &data, Format &fmt)
void _format_string(std::ostream &out, const T &data, Format &fmt)