|
| template<class Arg , class... Args> |
| size_t | c4::cat (substr buf, Arg const &a, Args const &...more) |
| | serialize the arguments, concatenating them to the given fixed-size buffer. More...
|
| |
| template<class... Args> |
| substr | c4::cat_sub (substr buf, Args const &...args) |
| | like c4::cat() but return a substr instead of a size More...
|
| |
| template<class CharOwningContainer , class... Args> |
| void | c4::catrs (CharOwningContainer *cont, Args const &...args) |
| | cat+resize: like c4::cat(), but receives a container, and resizes it as needed to contain the result. More...
|
| |
| template<class CharOwningContainer , class... Args> |
| CharOwningContainer | c4::catrs (Args const &...args) |
| | cat+resize: like c4::cat(), but creates and returns a new container sized as needed to contain the result. More...
|
| |
| template<class CharOwningContainer , class... Args> |
| csubstr | c4::catrs_append (CharOwningContainer *cont, Args const &...args) |
| | cat+resize+append: like c4::cat(), but receives a container, and appends to it instead of overwriting it. More...
|
| |
template<class Arg , class... Args>
| size_t c4::cat |
( |
substr |
buf, |
|
|
Arg const & |
a, |
|
|
Args const &... |
more |
|
) |
| |
serialize the arguments, concatenating them to the given fixed-size buffer.
The buffer size is strictly respected: no writes will occur beyond its end.
- Returns
- the number of characters needed to write all the arguments into the buffer.
- See also
- c4::catrs() if instead of a fixed-size buffer, a resizeable container is desired
-
c4::uncat() for the inverse function
-
c4::catsep() if a separator between each argument is to be used
-
c4::format() if a format string is desired
- Note
- The arguments to format are restricted (legal because they are rvalues). This may require a workaround when arguments of type char[]/const char[] are passed repeatedly to the function. For example,
const char str[] =
"Hi! ";
It is possible to work around the problem by suppressing -Wrestrict or by using the decayed type char* or const char*, or even wrapping the argument in a csubstr(): const char str[] =
"Hi! ";
Definition at line 649 of file format.hpp.
Referenced by c4::cat_sub(), c4::catrs(), c4::catrs_append(), and sample_formatting().
652 buf = buf.len >= num ? buf.sub(num) :
substr{};
653 num +=
cat(buf, more...);
size_t cat(substr buf, Arg const &a, Args const &...more)
serialize the arguments, concatenating them to the given fixed-size buffer.
basic_substring< char > substr
a mutable string view
size_t to_chars(substr buf, fmt::center_< T > const &align)
template<class CharOwningContainer , class... Args>
| void c4::catrs |
( |
CharOwningContainer * |
cont, |
|
|
Args const &... |
args |
|
) |
| |
|
inline |
cat+resize: like c4::cat(), but receives a container, and resizes it as needed to contain the result.
The container is overwritten. To append to it, use c4::catrs_append().
- See also
- c4::cat()
-
c4::catrs_append()
- Note
- The arguments to format are restricted (legal because they are rvalues). This may require a workaround when arguments of type char[]/const char[] are passed repeatedly to the function. For example,
const char str[] =
"Hi! ";
It is possible to work around the problem by suppressing -Wrestrict or by using the decayed type char* or const char*, or even wrapping the argument in a csubstr(): const char str[] =
"Hi! ";
Definition at line 1040 of file format.hpp.
Referenced by c4::catrs(), and sample_formatting().
1042 cont->resize(cont->capacity());
1045 size_t ret =
cat(buf, args...);
substr to_substr(char(&s)[N]) noexcept
size_t cat(substr buf, Arg const &a, Args const &...more)
serialize the arguments, concatenating them to the given fixed-size buffer.
basic_substring< char > substr
a mutable string view
template<class CharOwningContainer , class... Args>
| csubstr c4::catrs_append |
( |
CharOwningContainer * |
cont, |
|
|
Args const &... |
args |
|
) |
| |
|
inline |
cat+resize+append: like c4::cat(), but receives a container, and appends to it instead of overwriting it.
The container is resized as needed to contain the result.
- Returns
- the region newly appended to the original container
- See also
- c4::cat()
-
c4::catrs()
- Note
- The arguments to format are restricted (legal because they are rvalues). This may require a workaround when arguments of type char[]/const char[] are passed repeatedly to the function. For example,
const char str[] =
"Hi! ";
It is possible to work around the problem by suppressing -Wrestrict or by using the decayed type char* or const char*, or even wrapping the argument in a csubstr(): const char str[] =
"Hi! ";
Definition at line 1109 of file format.hpp.
Referenced by sample_formatting().
1111 const size_t pos = cont->size();
1112 cont->resize(cont->capacity());
1115 size_t ret =
cat(buf, args...);
1116 cont->resize(pos + ret);
substr to_substr(char(&s)[N]) noexcept
size_t cat(substr buf, Arg const &a, Args const &...more)
serialize the arguments, concatenating them to the given fixed-size buffer.
basic_substring sub(size_t first) const noexcept
return [first,len[
csubstr to_csubstr(const char(&s)[N]) noexcept
basic_substring< char > substr
a mutable string view
basic_substring range(size_t first, size_t last=npos) const noexcept
return [first,last[.