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>
53 int width = 80, CharT fill = CharT (
'-'))
57 title.
resize (width, fill);
71 template <
class CharT,
class Traits>
75 os << std::basic_string <CharT, Traits> (d.
width, d.
fill);
83 explicit fpad (
int width_,
int pad_ = 0,
char fill_ =
' ')
84 :
width (width_ + pad_)
89 template <
class CharT,
class Traits>
93 os << std::basic_string <CharT, Traits> (f.
width, f.
fill);
102 template <
typename T>
114 template <
class CharT,
131 template <
class CharT2,
class Traits2>
139 if (length < f.
width)
140 os << std::basic_string <CharT2, Traits2> (
141 f.
width - length, CharT2 (
' '));
147 if (length < f.
width)
148 os << std::basic_string <CharT2, Traits2> (
149 f.
width - length, CharT2 (
' '));
157 template <
class CharT,
class Traits,
class Allocator>
160 int width = 8,
int pad = 0,
bool right =
false)
163 text, width, pad, right);
166 template <
class CharT>
168 CharT
const* text,
int width = 8,
int pad = 0,
bool right =
false)
176 template <
typename T>
178 T
const& t,
int width = 8,
int pad = 0,
bool right =
false)
181 return field (text, width, pad, right);
184 template <
class CharT,
class Traits,
class Allocator>
187 int width = 8,
int pad = 0)
190 text, width, pad,
true);
193 template <
class CharT>
195 CharT
const* text,
int width = 8,
int pad = 0)
203 template <
typename T>
205 T
const& t,
int width = 8,
int pad = 0)
208 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)
field_t(string_t const &text_, int width_, int pad_, bool right_)
divider(int width_=80, CharT fill_=CharT('-'))
std::basic_string< CharT, Traits, Allocator > string_t
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)