34 template<
typename FSTREAM>
void operator()(FSTREAM& stream)
const
40 explicit constexpr setw_(uint8_t width) : width_{width} {}
42 friend constexpr const setw_
setw(uint8_t width);
44 template<
typename FSTREAM> FSTREAM& operator<<(FSTREAM& stream,
const setw_ f)
49 template<
typename FSTREAM> FSTREAM& operator>>(FSTREAM& stream,
const setw_ f)
58 template<
typename FSTREAM>
void operator()(FSTREAM& stream)
const
60 stream.precision(precision_);
64 explicit constexpr setprecision_(uint8_t precision) : precision_{precision} {}
65 const uint8_t precision_;
66 friend constexpr const setprecision_
setprecision(uint8_t precision);
68 template<
typename FSTREAM> FSTREAM& operator<<(FSTREAM& stream,
const setprecision_ f)
73 template<
typename FSTREAM> FSTREAM& operator>>(FSTREAM& stream,
const setprecision_ f)
82 template<
typename FSTREAM>
void operator()(FSTREAM& stream)
const
88 explicit constexpr setfill_(
char fill) : fill_{fill} {}
90 friend constexpr const setfill_
setfill(
char fill);
92 template<
typename FSTREAM> FSTREAM& operator<<(FSTREAM& stream,
const setfill_ f)
97 template<
typename FSTREAM> FSTREAM& operator>>(FSTREAM& stream,
const setfill_ f)
106 template<
typename FSTREAM>
void operator()(FSTREAM& stream)
const
108 stream.setf(base_, ios::basefield);
112 static constexpr ios::fmtflags convert_base(
int base)
114 if (base == 2)
return ios::bin;
115 if (base == 8)
return ios::oct;
116 if (base == 16)
return ios::hex;
119 explicit constexpr setbase_(
int base) : base_{convert_base(base)} {}
120 const ios::fmtflags base_;
121 friend constexpr const setbase_
setbase(
int base);
123 template<
typename FSTREAM> FSTREAM& operator<<(FSTREAM& stream,
const setbase_ f)
128 template<
typename FSTREAM> FSTREAM& operator>>(FSTREAM& stream,
const setbase_ f)
137 template<
typename FSTREAM>
void operator()(FSTREAM& stream)
const
143 explicit constexpr setiosflags_(ios::fmtflags mask) : mask_{mask} {}
144 const ios::fmtflags mask_;
145 friend constexpr const setiosflags_
setiosflags(ios::fmtflags mask);
147 template<
typename FSTREAM> FSTREAM& operator<<(FSTREAM& stream,
const setiosflags_ f)
152 template<
typename FSTREAM> FSTREAM& operator>>(FSTREAM& stream,
const setiosflags_ f)
161 template<
typename FSTREAM>
void operator()(FSTREAM& stream)
const
163 stream.unsetf(mask_);
167 explicit constexpr resetiosflags_(ios::fmtflags mask) : mask_{mask} {}
168 const ios::fmtflags mask_;
169 friend constexpr const resetiosflags_
resetiosflags(ios::fmtflags mask);
171 template<
typename FSTREAM> FSTREAM& operator<<(FSTREAM& stream,
const resetiosflags_ f)
176 template<
typename FSTREAM> FSTREAM& operator>>(FSTREAM& stream,
const resetiosflags_ f)
195 constexpr const setw_
setw(uint8_t width)
216 return setprecision_{precision};
240 return setbase_{base};
255 return setfill_{fill};
272 return setiosflags_{mask};
289 return resetiosflags_{mask};
uint16_t fmtflags
Bitmask type to represent stream format flags.
C++-like std::iostream facilities.
Defines C++-like streams API, based on circular buffers for input or output.
constexpr const setbase_ setbase(int base)
Set the ios::basefield to one of its possible values (ios::dec, ios::bin, ios::oct or ios::hex) accor...
constexpr const setprecision_ setprecision(uint8_t precision)
Set the decimal precision to be used to format floating-point values on output operations.
constexpr const setw_ setw(uint8_t width)
Set the field width to be used on output (and some input) operations.
constexpr const resetiosflags_ resetiosflags(ios::fmtflags mask)
Unset the format flags specified by mask.
constexpr const setfill_ setfill(char fill)
Set a new fill character.
constexpr const setiosflags_ setiosflags(ios::fmtflags mask)
Set the format flags specified by mask.