1#include "ostream_printf.h"
11void ostream_printf::parseFormatString()
22 bool alternate =
false;
24 while (m_format[i] != 0) {
33 flags |= ios::showpos;
39 flags |= ios::internal;
54 if ( isdigit(m_format[i]) ) {
55 width = atoi(m_format+i);
56 do{ i++; }
while( isdigit(m_format[i]) );
60 if (m_format[i] ==
'.') {
62 precision = atoi(m_format+i);
63 do{ i++; }
while( isdigit(m_format[i]) );
67 bool format_ok =
true;
84 if (alternate) flags |= ios::showbase;
87 flags |= ios::hex | ios::uppercase;
88 if (alternate) flags |= ios::showbase;
92 if (alternate) flags |= ios::showbase;
96 if (alternate) flags |= ios::showpoint;
99 flags |= ios::scientific;
100 if (alternate) flags |= ios::showpoint;
103 flags |= ios::scientific | ios::uppercase;
104 if (alternate) flags |= ios::showpoint;
107 if (alternate) flags |= ios::showpoint;
110 flags |= ios::uppercase;
111 if (alternate) flags |= ios::showpoint;
122 m_stream.unsetf(ios::adjustfield | ios::basefield | ios::floatfield);
123 m_stream.setf((std::ios_base::fmtflags)flags);
124 m_stream.width(width);
125 m_stream.precision(precision);
135void ostream_printf::printStaticData()
137 while ( m_format[m_pos] !=
'\0' )
139 if ( m_format[m_pos] ==
'%' )
141 if ( m_format[m_pos+1] ==
'%' )
145 m_stream << m_format[m_pos];