1#ifndef XRPL_PEERFINDER_IOSFORMAT_H_INCLUDED
2#define XRPL_PEERFINDER_IOSFORMAT_H_INCLUDED
20 template <
class CharT,
class Traits>
24 ios.
setf(std::ios_base::left, std::ios_base::adjustfield);
31template <
class CharT,
class Traits,
class Allocator>
36 CharT fill = CharT(
'-'))
54 template <
class CharT,
class Traits>
58 os << std::basic_string<CharT, Traits>(d.
width, d.
fill);
66 explicit fpad(
int width_,
int pad_ = 0,
char fill_ =
' ')
72 template <
class CharT,
class Traits>
76 os << std::basic_string<CharT, Traits>(f.
width, f.
fill);
114 template <
class CharT2,
class Traits2>
123 if (length < f.
width)
124 os << std::basic_string<CharT2, Traits2>(
125 f.
width - length, CharT2(
' '));
131 if (length < f.
width)
132 os << std::basic_string<CharT2, Traits2>(
133 f.
width - length, CharT2(
' '));
141template <
class CharT,
class Traits,
class Allocator>
142field_t<CharT, Traits, Allocator>
152template <
class CharT>
154field(CharT
const* text,
int width = 8,
int pad = 0,
bool right =
false)
167field(T
const& t,
int width = 8,
int pad = 0,
bool right =
false)
170 return field(text, width, pad, right);
173template <
class CharT,
class Traits,
class Allocator>
174field_t<CharT, Traits, Allocator>
183template <
class CharT>
185rfield(CharT
const* text,
int width = 8,
int pad = 0)
198rfield(T
const& t,
int width = 8,
int pad = 0)
201 return field(text, width, pad,
true);
Justifies a field at the specified width.
field_t(string_t const &text_, int width_, int pad_, bool right_)
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
std::string to_string(T const &t)
field_t< CharT, Traits, Allocator > field(std::basic_string< CharT, Traits, Allocator > const &text, int width=8, int pad=0, bool right=false)
field_t< CharT, Traits, Allocator > rfield(std::basic_string< CharT, Traits, Allocator > const &text, int width=8, int pad=0)
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.
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)
divider(int width_=80, CharT fill_=CharT('-'))
Creates a padded field with an optiona fill character.
fpad(int width_, int pad_=0, char fill_=' ')
friend std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > &os, fpad const &f)
Left justifies a field at the specified width.
friend std::basic_ios< CharT, Traits > & operator<<(std::basic_ios< CharT, Traits > &ios, leftw const &p)