async_mqtt 9.0.1
|
buffer that has string_view interface and shared ownership This class is only for advanced usecase such as developping high performance MQTT broker. Typical MQTT client developpers don't need to care about the buffer. This class provides string_view interface. This class holds string_view pointee's lifetime optionally. More...
#include <buffer.hpp>
Public Member Functions | |
constexpr | buffer () noexcept=default |
default constructor | |
buffer (buffer const &other)=default | |
copy constructor | |
buffer (buffer &&other)=default | |
move constructor | |
buffer & | operator= (buffer const &other)=default |
copy assign operator | |
buffer & | operator= (buffer &&other)=default |
move assign operator | |
constexpr | buffer (char const *s, std::size_t count) |
constructor The buffer doesn't manage the lifetime | |
constexpr | buffer (char const *s) |
constructor The buffer doesn't manage the lifetime | |
template<typename It , typename End , typename std::enable_if_t< detail::is_input_iterator< It >::value &&detail::is_input_iterator< End >::value > * = nullptr> | |
constexpr | buffer (It first, End last) |
move assign operator The buffer doesn't manage the lifetime. The memory between first and last must be continuous. | |
constexpr | buffer (std::string_view sv) |
std::string_view constructor | |
buffer (std::string s) | |
string constructor | |
buffer (std::string_view sv, std::shared_ptr< void > life) | |
std::string_view and lifetime constructor | |
buffer (char const *s, std::size_t count, std::shared_ptr< void > life) | |
pointer, size, and lifetime constructor | |
template<typename It , typename End , typename std::enable_if_t< detail::is_input_iterator< It >::value &&detail::is_input_iterator< End >::value > * = nullptr> | |
buffer (It first, End last, std::shared_ptr< void > life) | |
range and lifetime constructor | |
constexpr const_iterator | begin () const noexcept |
get an iterator to the beginning | |
constexpr const_iterator | cbegin () const noexcept |
get an iterator to the beginning | |
constexpr const_iterator | end () const noexcept |
get an iterator to the end | |
constexpr const_iterator | cend () const noexcept |
get an iterator to the end | |
constexpr const_reverse_iterator | rbegin () const noexcept |
get a reverse terator to the beginning | |
constexpr const_reverse_iterator | crbegin () const noexcept |
get a reverse terator to the beginning | |
constexpr const_reverse_iterator | rend () const noexcept |
get a reverse terator to the end | |
constexpr const_reverse_iterator | crend () const noexcept |
get a reverse terator to the end | |
constexpr const_reference | operator[] (size_type pos) const |
get a reference of the specific character | |
constexpr const_reference | at (size_type pos) const |
get a reference of the specific character with bounds checking | |
constexpr const_reference | front () const |
get a reference of the first character | |
constexpr const_reference | back () const |
get a reference of the last character | |
constexpr const_pointer | data () const noexcept |
get a pointer of the first character of the buffer | |
constexpr size_type | size () const noexcept |
get the number of characters | |
constexpr size_type | length () const noexcept |
get the number of characters | |
constexpr size_type | max_size () const noexcept |
get the largeset possible number of the buffer | |
constexpr bool | empty () const noexcept |
checking the buffer is empty | |
constexpr void | remove_prefix (size_type n) |
remove the first n characters from the buffer | |
constexpr void | remove_suffix (size_type n) |
remove the last n characters from the buffer | |
void | swap (buffer &buf) noexcept |
swap the buffer | |
size_type | copy (char *dest, size_type count, size_type pos=0) const |
copy the buffer characters | |
buffer | substr (size_type pos=0, size_type count=npos) const & |
get substring The returned buffer ragnge is the same as std::string_view::substr(). In addition the lifetime is shared between returned buffer and this buffer. | |
buffer | substr (size_type pos=0, size_type count=npos) && |
get substring The returned buffer ragnge is the same as std::string_view::substr(). In addition the lifetime is moved to returned buffer. | |
constexpr int | compare (buffer const &buf) const noexcept |
compare buffer Compare only the view. | |
constexpr int | compare (std::string_view const &v) const noexcept |
compare buffer Compare only the view. | |
constexpr int | compare (size_type pos1, size_type count1, buffer const &buf) const noexcept |
compare buffer Compare only the view. | |
constexpr int | compare (size_type pos1, size_type count1, std::string_view const &v) const noexcept |
compare buffer Compare only the view. | |
constexpr int | compare (size_type pos1, size_type count1, buffer const &buf, size_type pos2, size_type count2) const noexcept |
compare buffer Compare only the view. | |
constexpr int | compare (size_type pos1, size_type count1, std::string_view const &v, size_type pos2, size_type count2) const noexcept |
compare buffer Compare only the view. | |
constexpr int | compare (char const *s) const noexcept |
compare buffer Compare only the view. | |
constexpr int | compare (size_type pos1, size_type count1, char const *s) const noexcept |
compare buffer Compare only the view. | |
constexpr int | compare (size_type pos1, size_type count1, char const *s, size_type pos2, size_type count2) const noexcept |
compare buffer Compare only the view. | |
constexpr size_type | find (buffer const &buf, size_type pos=0) const noexcept |
find the first substring equal to the given view | |
constexpr size_type | find (std::string_view v, size_type pos=0) const noexcept |
find the first substring equal to the given view | |
constexpr size_type | find (char ch, size_type pos=0) const noexcept |
find the first substring equal to the given view | |
constexpr size_type | find (char const *s, size_type pos, size_type count) const |
find the first substring equal to the given view | |
constexpr size_type | find (char const *s, size_type pos=0) const |
find the first substring equal to the given view | |
constexpr size_type | rfind (buffer const &buf, size_type pos=npos) const noexcept |
find the last substring equal to the given view | |
constexpr size_type | rfind (std::string_view v, size_type pos=npos) const noexcept |
find the last substring equal to the given view | |
constexpr size_type | rfind (char ch, size_type pos=npos) const noexcept |
find the last substring equal to the given view | |
constexpr size_type | rfind (char const *s, size_type pos, size_type count) const |
find the last substring equal to the given view | |
constexpr size_type | rfind (char const *s, size_type pos=npos) const |
find the last substring equal to the given view | |
constexpr size_type | find_first_of (buffer const &buf, size_type pos=0) const noexcept |
find the first character equal to any of the characters in the given view | |
constexpr size_type | find_first_of (std::string_view v, size_type pos=0) const noexcept |
find the first character equal to any of the characters in the given view | |
constexpr size_type | find_first_of (char ch, size_type pos=0) const noexcept |
find the first character equal to any of the characters in the given view | |
constexpr size_type | find_first_of (char const *s, size_type pos, size_type count) const |
find the first character equal to any of the characters in the given view | |
constexpr size_type | find_first_of (char const *s, size_type pos=0) const |
find the first character equal to any of the characters in the given view | |
constexpr size_type | find_last_of (buffer const &buf, size_type pos=npos) const noexcept |
find the last character equal to any of the characters in the given view | |
constexpr size_type | find_last_of (std::string_view v, size_type pos=npos) const noexcept |
find the last character equal to any of the characters in the given view | |
constexpr size_type | find_last_of (char ch, size_type pos=npos) const noexcept |
find the last character equal to any of the characters in the given view | |
constexpr size_type | find_last_of (char const *s, size_type pos, size_type count) const |
find the last character equal to any of the characters in the given view | |
constexpr size_type | find_last_of (char const *s, size_type pos=npos) const |
find the last character equal to any of the characters in the given view | |
constexpr size_type | find_first_not_of (buffer const &buf, size_type pos=0) const noexcept |
find the first character not equal to any of the characters in the given view | |
constexpr size_type | find_first_not_of (std::string_view v, size_type pos=0) const noexcept |
find the first character not equal to any of the characters in the given view | |
constexpr size_type | find_first_not_of (char ch, size_type pos=0) const noexcept |
find the first character not equal to any of the characters in the given view | |
constexpr size_type | find_first_not_of (char const *s, size_type pos, size_type count) const |
find the first character not equal to any of the characters in the given view | |
constexpr size_type | find_first_not_of (char const *s, size_type pos=0) const |
find the first character not equal to any of the characters in the given view | |
constexpr size_type | find_last_not_of (buffer const &buf, size_type pos=npos) const noexcept |
find the last character not equal to any of the characters in the given view | |
constexpr size_type | find_last_not_of (std::string_view v, size_type pos=npos) const noexcept |
find the last character not equal to any of the characters in the given view | |
constexpr size_type | find_last_not_of (char ch, size_type pos=npos) const noexcept |
find the last character not equal to any of the characters in the given view | |
constexpr size_type | find_last_not_of (char const *s, size_type pos, size_type count) const |
find the last character not equal to any of the characters in the given view | |
constexpr size_type | find_last_not_of (char const *s, size_type pos=npos) const |
find the last character not equal to any of the characters in the given view | |
operator as::const_buffer () const | |
conversion operator to the buffer as asio const_buffer | |
operator std::string_view () const | |
conversion operator to the buffer as asio const_buffer | |
bool | has_life () const noexcept |
life checking | |
Friends | |
constexpr bool | operator== (buffer const &lhs, buffer const &rhs) noexcept |
equal operator comparison target is the view of the buffer. life holder is not compared. | |
constexpr bool | operator!= (buffer const &lhs, buffer const &rhs) noexcept |
not equal operator comparison target is the view of the buffer. life holder is not compared. | |
constexpr bool | operator< (buffer const &lhs, buffer const &rhs) noexcept |
less than operator comparison target is the view of the buffer. life holder is not compared. | |
constexpr bool | operator<= (buffer const &lhs, buffer const &rhs) noexcept |
less than or equal to operator comparison target is the view of the buffer. life holder is not compared. | |
constexpr bool | operator> (buffer const &lhs, buffer const &rhs) noexcept |
greater than operator comparison target is the view of the buffer. life holder is not compared. | |
constexpr bool | operator>= (buffer const &lhs, buffer const &rhs) noexcept |
greater than or equal to operator comparison target is the view of the buffer. life holder is not compared. | |
std::ostream & | operator<< (std::ostream &o, buffer const &v) |
output to the stream | |
buffer that has string_view interface and shared ownership This class is only for advanced usecase such as developping high performance MQTT broker. Typical MQTT client developpers don't need to care about the buffer. This class provides string_view interface. This class holds string_view pointee's lifetime optionally.
|
inlineconstexpr |
constructor The buffer doesn't manage the lifetime
s | the begin pointer of continuous memory that contains characters |
count | the length of the continuours memory |
|
inlineconstexpr |
constructor The buffer doesn't manage the lifetime
s | the begin pointer of continuous memory that contains characters. The characters must be null terminated. |
|
inlineconstexpr |
move assign operator The buffer doesn't manage the lifetime. The memory between first and last must be continuous.
first | the begin pointer of continuous memory that contains characters |
last | the end pointer of continuous memory that contains characters |
|
inlineexplicitconstexpr |
std::string_view constructor
sv | std::string_view This constructor doesn't hold the sv target's lifetime. It behaves as std::string_view. Caller needs to manage the target lifetime. |
|
inlineexplicit |
string constructor
s | string |
|
inlineexplicit |
std::string_view and lifetime constructor
sv | std::string_view |
life | sv target's lifetime keeping object by shared ownership If user creates buffer via this constructor, sp's lifetime is held by the buffer. |
|
inlineexplicit |
pointer, size, and lifetime constructor
s | pointer to the beginning of the view |
count | size of the view |
life | sv target's lifetime keeping object by shared ownership If user creates buffer via this constructor, sp's lifetime is held by the buffer. |
|
inlineexplicit |
range and lifetime constructor
first | iterator to the beginning of the view |
last | iterator to the end of the view |
life | sv target's lifetime keeping object by shared ownership If user creates buffer via this constructor, sp's lifetime is held by the buffer. |
|
inlineconstexpr |
get a reference of the specific character with bounds checking
pos | the position of the character |
|
inlineconstexpr |
get a reference of the last character
|
inlineconstexprnoexcept |
get an iterator to the beginning
|
inlineconstexprnoexcept |
get an iterator to the beginning
|
inlineconstexprnoexcept |
get an iterator to the end
|
inlineconstexprnoexcept |
compare buffer Compare only the view.
buf | target |
|
inlineconstexprnoexcept |
compare buffer Compare only the view.
s | target |
|
inlineconstexprnoexcept |
compare buffer Compare only the view.
pos1 | start position of the this view |
count1 | length of the this view |
buf | target |
|
inlineconstexprnoexcept |
compare buffer Compare only the view.
pos1 | start position of the this view |
count1 | length of the this view |
buf | target |
pos2 | start position of the buf's view |
count2 | length of the buf's view |
|
inlineconstexprnoexcept |
compare buffer Compare only the view.
pos1 | start position of the this view |
count1 | length of the this view |
s | target |
|
inlineconstexprnoexcept |
compare buffer Compare only the view.
pos1 | start position of the this view |
count1 | length of the this view |
s | target |
pos2 | start position of the s |
count2 | length of the s |
|
inlineconstexprnoexcept |
compare buffer Compare only the view.
pos1 | start position of the this view |
count1 | length of the this view |
v | target |
|
inlineconstexprnoexcept |
compare buffer Compare only the view.
pos1 | start position of the this view |
count1 | length of the this view |
v | target |
pos2 | start position of the buf's view |
count2 | length of the buf's view |
|
inlineconstexprnoexcept |
compare buffer Compare only the view.
v | target |
|
inline |
copy the buffer characters
dest | destination |
count | copy length |
pos | copy start position |
|
inlineconstexprnoexcept |
get a reverse terator to the beginning
|
inlineconstexprnoexcept |
get a reverse terator to the end
|
inlineconstexprnoexcept |
get a pointer of the first character of the buffer
|
inlineconstexprnoexcept |
checking the buffer is empty
|
inlineconstexprnoexcept |
get an iterator to the end
|
inlineconstexprnoexcept |
find the first substring equal to the given view
buf | view to search for |
pos | position at which to start the search |
|
inlineconstexprnoexcept |
find the first substring equal to the given view
ch | character to search for |
pos | position at which to start the search |
|
inlineconstexpr |
find the first substring equal to the given view
s | pointer to a string of characters to search for |
pos | position at which to start the search |
count | length of substring to search for |
|
inlineconstexpr |
find the first substring equal to the given view
s | pointer to a string of characters to search for |
pos | position at which to start the search |
|
inlineconstexprnoexcept |
find the first substring equal to the given view
v | view to search for |
pos | position at which to start the search |
|
inlineconstexprnoexcept |
find the first character not equal to any of the characters in the given view
buf | view to search for |
pos | position at which to start the search |
|
inlineconstexprnoexcept |
find the first character not equal to any of the characters in the given view
ch | character to search for |
pos | position at which to start the search |
|
inlineconstexpr |
find the first character not equal to any of the characters in the given view
s | view to search for |
pos | position at which to start the search |
count | length of the string of characters to compare |
|
inlineconstexpr |
find the first character not equal to any of the characters in the given view
s | pointer to a string of characters to compare |
pos | position at which to start the search |
|
inlineconstexprnoexcept |
find the first character not equal to any of the characters in the given view
v | view to search for |
pos | position at which to start the search |
|
inlineconstexprnoexcept |
find the first character equal to any of the characters in the given view
buf | view to search for |
pos | position at which to start the search |
|
inlineconstexprnoexcept |
find the first character equal to any of the characters in the given view
ch | character to search for |
pos | position at which to start the search |
|
inlineconstexpr |
find the first character equal to any of the characters in the given view
s | pointer to a string of characters to search for |
pos | position at which to start the search |
count | length of the string of characters to search for |
|
inlineconstexpr |
find the first character equal to any of the characters in the given view
s | pointer to a string of characters to search for |
pos | position at which to start the search |
|
inlineconstexprnoexcept |
find the first character equal to any of the characters in the given view
v | view to search for |
pos | position at which to start the search |
|
inlineconstexprnoexcept |
find the last character not equal to any of the characters in the given view
buf | view to search for |
pos | position at which to start the search |
|
inlineconstexprnoexcept |
find the last character not equal to any of the characters in the given view
ch | character to search for |
pos | position at which to start the search |
|
inlineconstexpr |
find the last character not equal to any of the characters in the given view
s | pointer to a string of characters to compare |
pos | position at which to start the search |
count | length of the string of characters to compare |
|
inlineconstexpr |
find the last character not equal to any of the characters in the given view
s | pointer to a string of characters to compare |
pos | position at which to start the search |
|
inlineconstexprnoexcept |
find the last character not equal to any of the characters in the given view
v | view to search for |
pos | position at which to start the search |
|
inlineconstexprnoexcept |
find the last character equal to any of the characters in the given view
buf | view to search for |
pos | position at which to start the search |
|
inlineconstexprnoexcept |
find the last character equal to any of the characters in the given view
ch | character to search for |
pos | position at which to start the search |
|
inlineconstexpr |
find the last character equal to any of the characters in the given view
s | pointer to a string of characters to search for |
pos | position at which to start the search |
count | length of the string of characters to search for |
|
inlineconstexpr |
find the last character equal to any of the characters in the given view
s | pointer to a string of characters to search for |
pos | position at which to start the search |
|
inlineconstexprnoexcept |
find the last character equal to any of the characters in the given view
v | view to search for |
pos | position at which to start the search |
|
inlineconstexpr |
get a reference of the first character
|
inlinenoexcept |
life checking
|
inlineconstexprnoexcept |
get the number of characters
|
inlineconstexprnoexcept |
get the largeset possible number of the buffer
|
inline |
conversion operator to the buffer as asio const_buffer
|
inline |
conversion operator to the buffer as asio const_buffer
|
inlineconstexpr |
get a reference of the specific character
pos | the position of the character |
|
inlineconstexprnoexcept |
get a reverse terator to the beginning
|
inlineconstexpr |
remove the first n characters from the buffer
n | remove length |
|
inlineconstexpr |
remove the last n characters from the buffer
n | remove length |
|
inlineconstexprnoexcept |
get a reverse terator to the end
|
inlineconstexprnoexcept |
find the last substring equal to the given view
buf | view to search for |
pos | position at which to start the search |
|
inlineconstexprnoexcept |
find the last substring equal to the given view
ch | character to search for |
pos | position at which to start the search |
|
inlineconstexpr |
find the last substring equal to the given view
s | pointer to a string of characters to search for |
pos | position at which to start the search |
count | length of substring to search for |
|
inlineconstexpr |
find the last substring equal to the given view
s | pointer to a string of characters to search for |
pos | position at which to start the search |
|
inlineconstexprnoexcept |
find the last substring equal to the given view
v | view to search for |
pos | position at which to start the search |
|
inlineconstexprnoexcept |
get the number of characters
|
inline |
get substring The returned buffer ragnge is the same as std::string_view::substr(). In addition the lifetime is moved to returned buffer.
pos | position of the first character |
count | requested length |
|
inline |
get substring The returned buffer ragnge is the same as std::string_view::substr(). In addition the lifetime is shared between returned buffer and this buffer.
pos | position of the first character |
count | requested length |
|
inlinenoexcept |
swap the buffer
buf | target |
not equal operator comparison target is the view of the buffer. life holder is not compared.
lhs | compare target |
rhs | compare target |
less than operator comparison target is the view of the buffer. life holder is not compared.
lhs | compare target |
rhs | compare target |
|
friend |
output to the stream
o | output stream |
v | target |
less than or equal to operator comparison target is the view of the buffer. life holder is not compared.
lhs | compare target |
rhs | compare target |
equal operator comparison target is the view of the buffer. life holder is not compared.
lhs | compare target |
rhs | compare target |
greater than operator comparison target is the view of the buffer. life holder is not compared.
lhs | compare target |
rhs | compare target |
greater than or equal to operator comparison target is the view of the buffer. life holder is not compared.
lhs | compare target |
rhs | compare target |