CRTP base class that provides a rich API for classes that behave like byte buffers.
More...
|
| | operator bool () const |
| | Return true if size() != 0. More...
|
| |
| bool | operator! () const |
| | Return true if size() == 0. More...
|
| |
| bool | empty () const |
| | Return true if size() == 0. More...
|
| |
| std::ptrdiff_t | ssize () const |
| | Return the size as std::ptrdiff_t. More...
|
| |
| auto * | udata () |
| | Return the data buffer as unsigned char *. More...
|
| |
| auto * | udata () const |
| | Return the data buffer as const unsigned char * or unsigned char *, const-ness inherited from Self_t::data() const. More...
|
| |
| auto * | bdata () |
| | Return the data buffer as std::byte *. More...
|
| |
| auto * | bdata () const |
| | Return the data buffer as const std::byte * or std::byte *, const-ness inherited from Self_t::data() const. More...
|
| |
| std::string_view | string_view () const |
| |
| auto * | begin () |
| | Return the begin as char *. More...
|
| |
| auto * | begin () const |
| | Return the begin as const char * or char *, const-ness inherited from Self_t::data() const. More...
|
| |
| auto * | cbegin () const |
| | Return the begin as const char * or char *, const-ness inherited from Self_t::data() const. More...
|
| |
| auto * | ubegin () |
| | Return the begin as unsigned char *. More...
|
| |
| auto * | ubegin () const |
| | Return the begin as const unsigned char * or unsigned char *, const-ness inherited from Self_t::data() const. More...
|
| |
| auto * | cubegin () const |
| | Return the begin as const unsigned char * or unsigned char *, const-ness inherited from Self_t::data() const. More...
|
| |
| auto * | bbegin () |
| | Return the begin as std::byte *. More...
|
| |
| auto * | bbegin () const |
| | Return the begin as const std::byte * or std::byte *, const-ness inherited from Self_t::data() const. More...
|
| |
| auto * | cbbegin () const |
| | Return the begin as const std::byte * or std::byte *, const-ness inherited from Self_t::data() const. More...
|
| |
| auto * | end () |
| | Return the end as char *. More...
|
| |
| auto * | end () const |
| | Return the end as const char * or char *, const-ness inherited from Self_t::data() const. More...
|
| |
| auto * | cend () const |
| | Return the end as const char * or char *, const-ness inherited from Self_t::data() const. More...
|
| |
| auto * | uend () |
| | Return the end as unsigned char *. More...
|
| |
| auto * | uend () const |
| | Return the end as const unsigned char * or unsigned char *, const-ness inherited from Self_t::data() const. More...
|
| |
| auto * | cuend () const |
| | Return the end as const unsigned char * or unsigned char *, const-ness inherited from Self_t::data() const. More...
|
| |
| auto * | bend () |
| | Return the end as std::byte *. More...
|
| |
| auto * | bend () const |
| | Return the end as const std::byte * or std::byte *, const-ness inherited from Self_t::data() const. More...
|
| |
| auto * | cbend () const |
| | Return the end as const std::byte * or or std::byte *, const-ness inherited from Self_t::data() const. More...
|
| |
| char & | operator[] (std::ptrdiff_t n) |
| | Return reference the n'th element. More...
|
| |
| char | operator[] (std::ptrdiff_t n) const |
| | Return the n'th element, const-ness inherited from Self_t::data() const. More...
|
| |
template<class Self_tp,
Equality_algorithm equality_algorithm_tp = Equality_algorithm::lexicographic,
Enable_hash enable_hash_tp = Enable_hash::yes>
class mysql::ranges::Buffer_interface< Self_tp, equality_algorithm_tp, enable_hash_tp >
CRTP base class that provides a rich API for classes that behave like byte buffers.
This turns a subclass that implements size() and data() members into a std::ranges::range, defines the same members that std::view_interface defines, enables comparisons and hashes, and for any member that uses char *, provides alternative members that use unsigned char * and std::byte.
The subclass should implement the following member functions:
char *data();
const char *data() const;
size_t size(const char *const c)
Definition: base64.h:46
This class provides the members:
string_view: Return an std::string_view.
[u|b]data: Return data as unsigned char * or std::byte *.
[c][u|b]begin/[c][u|b]end: Return (const) begin/end pointers as char *, unsigned char *, or std::byte *.
operator[]: Return the n'th element.
ssize: Return the size as a signed integer (std::ptrdiff_t).
empty: Return size() == 0.
operator bool: return size() != 0. Optionally, the following free functions are provided:
operator==, operator!=, and operator<=>.
std::hash.
The following alternative prototypes are allowed:
I.e., the data may be non-const even if the buffer object is const. This is useful when the buffer object does not own the data.
- Template Parameters
-
| Self_tp | Subclass. |
| equality_algorithm_tp | Determines if and how operators ==, !=, <, >, <=, >=, and <=> are implemented: lexicographic compares strings lexicographically, for example, "a" < "aa" < "b"; fast compares the length first, and compares lexicographically only when the lengths are equal, for example, "a" < "b" < "aa"; none does not implement comparison at all. Default is lexicographic. |
| enable_hash_tp | If yes, enable std::hash<Self_tp>. Default is yes. |