20 #ifndef RIPPLE_PEERFINDER_IOSFORMAT_H_INCLUDED
21 #define RIPPLE_PEERFINDER_IOSFORMAT_H_INCLUDED
39 template <
class CharT,
class Traits>
43 ios.
setf(std::ios_base::left, std::ios_base::adjustfield);
50 template <
class CharT,
class Traits,
class Allocator>
55 CharT fill = CharT(
'-'))
73 template <
class CharT,
class Traits>
77 os << std::basic_string<CharT, Traits>(d.
width, d.
fill);
85 explicit fpad(
int width_,
int pad_ = 0,
char fill_ =
' ')
91 template <
class CharT,
class Traits>
95 os << std::basic_string<CharT, Traits>(f.
width, f.
fill);
104 template <
typename T>
133 template <
class CharT2,
class Traits2>
142 if (length < f.
width)
143 os << std::basic_string<CharT2, Traits2>(
144 f.
width - length, CharT2(
' '));
150 if (length < f.
width)
151 os << std::basic_string<CharT2, Traits2>(
152 f.
width - length, CharT2(
' '));
160 template <
class CharT,
class Traits,
class Allocator>
161 field_t<CharT, Traits, Allocator>
171 template <
class CharT>
173 field(CharT
const* text,
int width = 8,
int pad = 0,
bool right =
false)
184 template <
typename T>
186 field(T
const& t,
int width = 8,
int pad = 0,
bool right =
false)
189 return field(text, width, pad, right);
192 template <
class CharT,
class Traits,
class Allocator>
193 field_t<CharT, Traits, Allocator>
202 template <
class CharT>
204 rfield(CharT
const* text,
int width = 8,
int pad = 0)
215 template <
typename T>
217 rfield(T
const& t,
int width = 8,
int pad = 0)
220 return field(text, width, pad,
true);
fpad(int width_, int pad_=0, char fill_=' ')
friend std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > &os, fpad const &f)
field_t< CharT, Traits, Allocator > rfield(std::basic_string< CharT, Traits, Allocator > const &text, int width=8, int pad=0)
friend std::basic_ios< CharT, Traits > & operator<<(std::basic_ios< CharT, Traits > &ios, leftw const &p)
friend std::basic_ostream< CharT2, Traits2 > & operator<<(std::basic_ostream< CharT2, Traits2 > &os, field_t< CharT, Traits, Allocator > const &f)
std::basic_string< CharT, Traits, Allocator > string_t
field_t(string_t const &text_, int width_, int pad_, bool right_)
divider(int width_=80, CharT fill_=CharT('-'))
Left justifies a field at the specified width.
field_t< CharT, Traits, Allocator > field(std::basic_string< CharT, Traits, Allocator > const &text, int width=8, int pad=0, bool right=false)
std::basic_string< CharT, Traits, Allocator > heading(std::basic_string< CharT, Traits, Allocator > title, int width=80, CharT fill=CharT('-'))
Produce a section heading and fill the rest of the line with dashes.
Creates a padded field with an optiona fill character.
Justifies a field at the specified width.
Produce a dashed line separator, with a specified or default size.
friend std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > &os, divider const &d)
std::string to_string(T const &t)