header_utils
|
Buffers and stuff. More...
template<typename BUFFER > | |
using | ghassanpl::buffer_element_type = typename decltype(detail::deduce_buffer_element_type< BUFFER >())::type |
template<typename BUFFER , typename T > | |
bool | ghassanpl::buffer_append (BUFFER &&buffer, T &&val) |
Primary function to append a value (preferably the buffer element type) to the buffer. | |
template<typename BUFFER > | |
bool | ghassanpl::buffer_reserve (BUFFER &buffer, size_t additional) |
Reserves additional elements in the buffer, if possible. | |
template<typename BUFFER , typename RANGE > requires output_buffer<BUFFER, std::ranges::range_value_t<RANGE>> | |
size_t | ghassanpl::buffer_append_range (BUFFER &buffer, RANGE &&range) |
Appends elements in the range to the buffer | |
template<typename BUFFER , typename CHAR_TYPE > requires output_buffer<BUFFER, CHAR_TYPE> | |
size_t | ghassanpl::buffer_append_cstring_ptr (BUFFER &buffer, const CHAR_TYPE *cstr) |
Appends characters in the cstr to the buffer | |
template<typename BUFFER , typename CHAR_TYPE > requires output_buffer<BUFFER, CHAR_TYPE> | |
size_t | ghassanpl::buffer_append_cstring_ptr (BUFFER &buffer, const CHAR_TYPE *cstr, size_t max_len) |
Appends at most max_len characters in the cstr to the buffer | |
template<typename BUFFER , size_t N, typename CHAR_TYPE > requires output_buffer<BUFFER, CHAR_TYPE> | |
size_t | ghassanpl::buffer_append_cstring (BUFFER &buffer, const CHAR_TYPE(&cstr)[N]) |
Appends characters in the cstr literal array to the buffer | |
template<typename BUFFER , typename ELEMENT_TYPE = buffer_element_type<BUFFER>> requires output_buffer<BUFFER, ELEMENT_TYPE> | |
size_t | ghassanpl::buffer_append_utf8 (BUFFER &buffer, char32_t cp) |
Appends UTF-8 codeunits that represent the Unicode code-point cp to the buffer . Assumes the codepoint is a valid Unicode codepoint that represents a character. | |
template<typename BUFFER , typename STRING_TYPE , typename ELEMENT_TYPE = buffer_element_type<BUFFER>> requires output_buffer<BUFFER, ELEMENT_TYPE> && std::ranges::range<STRING_TYPE> && std::same_as<std::ranges::range_value_t<STRING_TYPE>, char32_t> | |
size_t | ghassanpl::buffer_append_utf8 (BUFFER &buffer, STRING_TYPE &&str) |
Appends UTF-8 codeunits that represent the UTF-32 range str to the buffer . | |
template<typename BUFFER , typename POD > requires std::is_trivially_copyable_v<POD> && bytelike<buffer_element_type<BUFFER>> | |
size_t | ghassanpl::buffer_append_pod (BUFFER &buffer, POD const &pod) |
Appends a POD values internal object representation to a buffer. | |
template<typename BUFFER , typename CALLBACK > requires std::invocable<CALLBACK, size_t, std::string_view, BUFFER&> | |
void | ghassanpl::callback_format_to (BUFFER &buffer, std::string_view fmt, CALLBACK &&callback) |
TODO: Make this work - currently needs string_ops | |
Buffers and stuff.
size_t ghassanpl::buffer_append_utf8 | ( | BUFFER & | buffer, |
char32_t | cp | ||
) |
size_t ghassanpl::buffer_append_utf8 | ( | BUFFER & | buffer, |
STRING_TYPE && | str | ||
) |
Appends UTF-8 codeunits that represent the UTF-32 range str
to the buffer
.
Assumes all codepoints in str
are valid.