rapidyaml 0.14.0
parse and emit YAML, and do it fast
Loading...
Searching...
No Matches
Alignment specifiers

Classes

struct  c4::fmt::left_< T >
struct  c4::fmt::center_< T >
struct  c4::fmt::right_< T >

Functions

template<class T>
left_< T > c4::fmt::left (T val, size_t width, char padchar=' ')
 tag type to mark an argument to be aligned left.
template<class T>
center_< T > c4::fmt::center (T val, size_t width, char padchar=' ')
 tag function to mark an argument to be aligned center
template<class T>
right_< T > c4::fmt::right (T val, size_t width, char padchar=' ')
 tag function to mark an argument to be aligned right

Detailed Description

Function Documentation

◆ left()

template<class T>
left_< T > c4::fmt::left ( T val,
size_t width,
char padchar = ' ' )

tag type to mark an argument to be aligned left.

Parameters
valthe argument to be aligned left
widththe length of the field
padcharthe padding character, defaults to ' '
Note
This function (and the return structure) uses value semantics. To avoid copies on larger types, you can use std::cref(). For example:
char buf[512];
std::string large_string = .....;
size_t len = cat(buf, fmt::left(std::cref(large_string), 100));
left_< T > left(T val, size_t width, char padchar=' ')
tag type to mark an argument to be aligned left.
Definition format.hpp:515
size_t cat(substr buf, Arg const &a, Args const &...more)
serialize the arguments, concatenating them to the given fixed-size buffer.
Definition format.hpp:649

Definition at line 515 of file format.hpp.

516{
517 return left_<T>(val, width, padchar);
518}

◆ center()

template<class T>
center_< T > c4::fmt::center ( T val,
size_t width,
char padchar = ' ' )

tag function to mark an argument to be aligned center

Parameters
valthe argument to be aligned center
widththe length of the field
padcharthe padding character, defaults to ' '
Note
This function (and the return value) uses value semantics. To avoid copies on larger types, you can use std::cref(). For example:
char buf[512];
std::string large_string = .....;
size_t len = cat(buf, fmt::center(std::cref(large_string), 100));
center_< T > center(T val, size_t width, char padchar=' ')
tag function to mark an argument to be aligned center
Definition format.hpp:534

Definition at line 534 of file format.hpp.

535{
536 return center_<T>(val, width, padchar);
537}

◆ right()

template<class T>
right_< T > c4::fmt::right ( T val,
size_t width,
char padchar = ' ' )

tag function to mark an argument to be aligned right

Parameters
valthe argument to be aligned right
widththe length of the field
padcharthe padding character, defaults to ' '
Note
This function (and the return value) uses value semantics. To avoid copies on larger types, you can use std::cref(). For example:
char buf[512];
std::string large_string = .....;
size_t len = cat(buf, fmt::right(std::cref(large_string), 100));
right_< T > right(T val, size_t width, char padchar=' ')
tag function to mark an argument to be aligned right
Definition format.hpp:553

Definition at line 553 of file format.hpp.

554{
555 return right_<T>(val, width, padchar);
556}