示例#1
0
 format_parser::format_parser(std::ios_base &ios,void *cookie,void (*imbuer)(void *,std::locale const &)) : 
     ios_(ios),
     d(new data)
 {
     d->position=std::numeric_limits<unsigned>::max();
     d->precision=ios.precision();
     d->flags = ios.flags();
     d->info=ios_info::get(ios);
     d->saved_locale = ios.getloc();
     d->restore_locale=false;
     d->cookie = cookie;
     d->imbuer = imbuer;
 }
示例#2
0
bool logstream_base::set_stream_state(std::ios_base& dest, int& dstchar) {
     std::ios_base::fmtflags setval = initset.flags();
     std::ios_base::fmtflags clrval = initclear.flags();
     std::ios_base::fmtflags mask = setval ^ (~clrval);
     dest.setf(clrval, mask);
     if (initset.precision() == initclear.precision()) {
         dest.precision(initset.precision());
     }
     if (initset.width() == initclear.width()) {
         dest.width(initset.width());
     }
     dstchar = fillchar;
     return fillset;
}
示例#3
0
inline void lcast_set_precision(std::ios_base& stream, Source*, Target*)
{
    std::streamsize const s = lcast_get_precision(static_cast<Source*>(0));
    std::streamsize const t = lcast_get_precision(static_cast<Target*>(0));
    stream.precision(s > t ? s : t);
}
示例#4
0
inline void lcast_set_precision(std::ios_base& stream, T*)
{
    stream.precision(lcast_get_precision<T>());
}