42 #ifndef LINALGPACK_IO_FORMAT_H 43 #define LINALGPACK_IO_FORMAT_H 47 #include "DenseLinAlgPack_IOBasic.hpp" 50 namespace LinAlgPackIO {
71 fmtflags f_tmp = flags_;
77 fmtflags
setf(fmtflags f) {
82 fmtflags
setf(fmtflags f, fmtflags mask) {
83 return flags( (fmtflags)(
flags() | (f&mask)) );
112 void set_format(std::ios& s)
const;
115 LinAlgPackIO::fmtflags flags_;
164 format() : prec_(6), wdt_(0), fill_(
' ') {}
204 format&
showpoint() { ios_base_flags().setf(std::ios_base::showpoint);
return *
this; }
208 format&
showpos() { ios_base_flags().setf(std::ios_base::showpos);
return *
this; }
210 format&
noshowpos() { ios_base_flags().unsetf(std::ios_base::showpos);
return *
this; }
212 format&
skipws() { ios_base_flags().setf(std::ios_base::skipws);
return *
this; }
214 format&
noskipws() { ios_base_flags().unsetf(std::ios_base::skipws);
return *
this; }
216 format&
uppercase() { ios_base_flags().setf(std::ios_base::uppercase);
return *
this; }
221 ios_base_flags().setf(std::ios_base::internal, std::ios_base::adjustfield);
226 ios_base_flags().setf(std::ios_base::left, std::ios_base::adjustfield);
231 ios_base_flags().setf(std::ios_base::right, std::ios_base::adjustfield);
236 ios_base_flags().setf((fmtflags)0, std::ios_base::floatfield);
241 ios_base_flags().setf(std::ios_base::fixed, std::ios_base::floatfield);
246 ios_base_flags().setf(std::ios_base::scientific, std::ios_base::floatfield);
276 extra_flags().setf((fmtflags)(ignore_dim_bit));
282 extra_flags().unsetf((fmtflags)(ignore_dim_bit));
288 extra_flags().unsetf((fmtflags)(no_insert_newlines_bit));
294 extra_flags().setf((fmtflags)(no_insert_newlines_bit));
307 int precision(
int p) {
int tmp = prec_; prec_ = p;
return tmp; }
311 int width(
int w) {
int tmp = wdt_; wdt_ = w;
return tmp; }
313 int fill()
const {
return fill_; }
315 int fill(
int c) {
int tmp = fill_; fill_ = c;
return tmp; }
324 void copy_format(
const std::ios& s);
327 void set_format(std::ios& s)
const;
384 const T&
obj()
const {
return obj_; }
420 const T&
obj()
const {
return obj_; }
481 #endif // LINALGPACK_IO_FORMAT_H
fmtflags flags(fmtflags f)
Set the flags.
fmtflags setf(fmtflags f)
Set a flag.
LinAlgPackIO::fmtflags fmtflags
fmtflags setf(fmtflags f, fmtflags mask)
Set a flag under a mask.
void unsetf(fmtflags mask)
Unset a flag(s)
fmtflags flags() const
Get the flags.
bit_flags()
Initialize the flags to 0x0000.