BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bslfmt::PadUtil< t_CHAR > Struct Template Reference

#include <bslfmt_padutil.h>

Detailed Description

template<class t_CHAR>
struct bslfmt::PadUtil< t_CHAR >

This struct serves as a namespace for static functions related to padding output by bslfmt.

See bslfmt_padutil

Public Types

typedef FormatterSpecificationNumericValue NumericValue
 
typedef FormatSpecificationParserEnums Enums
 
typedef Enums::Alignment Alignment
 

Public Member Functions

 BSLMF_ASSERT ((bsl::is_same< t_CHAR, char >::value||bsl::is_same< t_CHAR, wchar_t >::value))
 

Static Public Member Functions

static void computePadding (std::ptrdiff_t *leftPadding, std::ptrdiff_t *rightPadding, const NumericValue &widthValue, std::ptrdiff_t contentWidth, Alignment alignment, Alignment defaultAlign=Enums::e_ALIGN_LEFT)
 
template<class t_ITERATOR >
static t_ITERATOR pad (t_ITERATOR out, std::ptrdiff_t padWidth, const bsl::string_view &filler)
 
template<class t_ITERATOR >
static t_ITERATOR pad (t_ITERATOR out, std::ptrdiff_t padWidth, const bsl::wstring_view &filler)
 
template<class t_ITERATOR >
static t_ITERATOR pad (t_ITERATOR out, std::ptrdiff_t padWidth, char filler)
 
template<class t_ITERATOR >
static t_ITERATOR pad (t_ITERATOR out, std::ptrdiff_t padWidth, wchar_t filler)
 

Member Typedef Documentation

◆ Alignment

template<class t_CHAR >
typedef Enums::Alignment bslfmt::PadUtil< t_CHAR >::Alignment

◆ Enums

template<class t_CHAR >
typedef FormatSpecificationParserEnums bslfmt::PadUtil< t_CHAR >::Enums

◆ NumericValue

template<class t_CHAR >
typedef FormatterSpecificationNumericValue bslfmt::PadUtil< t_CHAR >::NumericValue

Member Function Documentation

◆ BSLMF_ASSERT()

template<class t_CHAR >
bslfmt::PadUtil< t_CHAR >::BSLMF_ASSERT ( (bsl::is_same< t_CHAR, char >::value||bsl::is_same< t_CHAR, wchar_t >::value)  )

◆ computePadding()

template<class t_CHAR >
void bslfmt::PadUtil< t_CHAR >::computePadding ( std::ptrdiff_t *  leftPadding,
std::ptrdiff_t *  rightPadding,
const NumericValue widthValue,
std::ptrdiff_t  contentWidth,
Alignment  alignment,
Alignment  defaultAlign = Enums::e_ALIGN_LEFT 
)
static

Compute the left and right padding values needed to format content with the specified contentWidth within a field of the width specified by widthValue using the specified alignment. If Enums::e_ALIGN_DEFAULT is passed to alignment, use the specified defaultAlign instead. Load the computed padding values into the specified leftPadding and rightPadding. If the category of widthValue is not e_VALUE or if the value indicated by widthValue is less than contentWidth, the padding is zero.

Precondition
The behavior is undefined if contentWidth specifies a negative width, or if defaultAlign specifies e_ALIGN_DEFAULT.

◆ pad() [1/4]

template<class t_CHAR >
template<class t_ITERATOR >
t_ITERATOR bslfmt::PadUtil< t_CHAR >::pad ( t_ITERATOR  out,
std::ptrdiff_t  padWidth,
char  filler 
)
inlinestatic

◆ pad() [2/4]

template<class t_CHAR >
template<class t_ITERATOR >
t_ITERATOR bslfmt::PadUtil< t_CHAR >::pad ( t_ITERATOR  out,
std::ptrdiff_t  padWidth,
const bsl::string_view filler 
)
static

Write the specified filler (possibly a multi-byte unicode sequence) to the specified out the specified padWidth times and return the new output iterator. If padWidth < 0, no output is done.

Precondition
The behavior is undefined unless the character type of filler is the same as t_CHAR or filler is entirely ascii.
Note
Note that the overloads that input a single character have an advantage over bsl::fill_n in that they will automatically widen or narrow the input character to t_CHAR if necessary.

◆ pad() [3/4]

template<class t_CHAR >
template<class t_ITERATOR >
t_ITERATOR bslfmt::PadUtil< t_CHAR >::pad ( t_ITERATOR  out,
std::ptrdiff_t  padWidth,
const bsl::wstring_view filler 
)
static

◆ pad() [4/4]

template<class t_CHAR >
template<class t_ITERATOR >
t_ITERATOR bslfmt::PadUtil< t_CHAR >::pad ( t_ITERATOR  out,
std::ptrdiff_t  padWidth,
wchar_t  filler 
)
inlinestatic

The documentation for this struct was generated from the following file: