async_mqtt 9.0.1
Loading...
Searching...
No Matches

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
 
bufferoperator= (buffer const &other)=default
 copy assign operator
 
bufferoperator= (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
 

Detailed Description

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.

Thread Safety

  • Distinct objects: Safe
  • Shared objects: Unsafe

Requirements

Constructor & Destructor Documentation

◆ buffer() [1/8]

async_mqtt::buffer::buffer ( char const * s,
std::size_t count )
inlineconstexpr

constructor The buffer doesn't manage the lifetime

Parameters
sthe begin pointer of continuous memory that contains characters
countthe length of the continuours memory

◆ buffer() [2/8]

async_mqtt::buffer::buffer ( char const * s)
inlineconstexpr

constructor The buffer doesn't manage the lifetime

Parameters
sthe begin pointer of continuous memory that contains characters. The characters must be null terminated.

◆ buffer() [3/8]

template<typename It , typename End , typename std::enable_if_t< detail::is_input_iterator< It >::value &&detail::is_input_iterator< End >::value > * = nullptr>
async_mqtt::buffer::buffer ( It first,
End last )
inlineconstexpr

move assign operator The buffer doesn't manage the lifetime. The memory between first and last must be continuous.

Parameters
firstthe begin pointer of continuous memory that contains characters
lastthe end pointer of continuous memory that contains characters

◆ buffer() [4/8]

async_mqtt::buffer::buffer ( std::string_view sv)
inlineexplicitconstexpr

std::string_view constructor

Parameters
svstd::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.

◆ buffer() [5/8]

async_mqtt::buffer::buffer ( std::string s)
inlineexplicit

string constructor

Parameters
sstring

◆ buffer() [6/8]

async_mqtt::buffer::buffer ( std::string_view sv,
std::shared_ptr< void > life )
inlineexplicit

std::string_view and lifetime constructor

Parameters
svstd::string_view
lifesv target's lifetime keeping object by shared ownership If user creates buffer via this constructor, sp's lifetime is held by the buffer.

◆ buffer() [7/8]

async_mqtt::buffer::buffer ( char const * s,
std::size_t count,
std::shared_ptr< void > life )
inlineexplicit

pointer, size, and lifetime constructor

Parameters
spointer to the beginning of the view
countsize of the view
lifesv target's lifetime keeping object by shared ownership If user creates buffer via this constructor, sp's lifetime is held by the buffer.

◆ buffer() [8/8]

template<typename It , typename End , typename std::enable_if_t< detail::is_input_iterator< It >::value &&detail::is_input_iterator< End >::value > * = nullptr>
async_mqtt::buffer::buffer ( It first,
End last,
std::shared_ptr< void > life )
inlineexplicit

range and lifetime constructor

Parameters
firstiterator to the beginning of the view
lastiterator to the end of the view
lifesv target's lifetime keeping object by shared ownership If user creates buffer via this constructor, sp's lifetime is held by the buffer.

Member Function Documentation

◆ at()

const_reference async_mqtt::buffer::at ( size_type pos) const
inlineconstexpr

get a reference of the specific character with bounds checking

Parameters
posthe position of the character
Returns
reference of the character

◆ back()

const_reference async_mqtt::buffer::back ( ) const
inlineconstexpr

get a reference of the last character

Returns
reference of the character

◆ begin()

const_iterator async_mqtt::buffer::begin ( ) const
inlineconstexprnoexcept

get an iterator to the beginning

Returns
iterator

◆ cbegin()

const_iterator async_mqtt::buffer::cbegin ( ) const
inlineconstexprnoexcept

get an iterator to the beginning

Returns
iterator

◆ cend()

const_iterator async_mqtt::buffer::cend ( ) const
inlineconstexprnoexcept

get an iterator to the end

Returns
iterator

◆ compare() [1/9]

int async_mqtt::buffer::compare ( buffer const & buf) const
inlineconstexprnoexcept

compare buffer Compare only the view.

Parameters
buftarget
Returns
negative value if if this view is less that the buf's view. zero the both view has the same sequences of the characters. posiative value if if this view is greater that the buf's view.

◆ compare() [2/9]

int async_mqtt::buffer::compare ( char const * s) const
inlineconstexprnoexcept

compare buffer Compare only the view.

Parameters
starget
Returns
negative value if if this view is less that the buf's view. zero the both view has the same sequences of the characters. posiative value if if this view is greater that the buf's view.

◆ compare() [3/9]

int async_mqtt::buffer::compare ( size_type pos1,
size_type count1,
buffer const & buf ) const
inlineconstexprnoexcept

compare buffer Compare only the view.

Parameters
pos1start position of the this view
count1length of the this view
buftarget
Returns
negative value if if this view is less that the buf's view. zero the both view has the same sequences of the characters. posiative value if if this view is greater that the buf's view.

◆ compare() [4/9]

int async_mqtt::buffer::compare ( size_type pos1,
size_type count1,
buffer const & buf,
size_type pos2,
size_type count2 ) const
inlineconstexprnoexcept

compare buffer Compare only the view.

Parameters
pos1start position of the this view
count1length of the this view
buftarget
pos2start position of the buf's view
count2length of the buf's view
Returns
negative value if if this view is less that the buf's view. zero the both view has the same sequences of the characters. posiative value if if this view is greater that the buf's view.

◆ compare() [5/9]

int async_mqtt::buffer::compare ( size_type pos1,
size_type count1,
char const * s ) const
inlineconstexprnoexcept

compare buffer Compare only the view.

Parameters
pos1start position of the this view
count1length of the this view
starget
Returns
negative value if if this view is less that the buf's view. zero the both view has the same sequences of the characters. posiative value if if this view is greater that the buf's view.

◆ compare() [6/9]

int async_mqtt::buffer::compare ( size_type pos1,
size_type count1,
char const * s,
size_type pos2,
size_type count2 ) const
inlineconstexprnoexcept

compare buffer Compare only the view.

Parameters
pos1start position of the this view
count1length of the this view
starget
pos2start position of the s
count2length of the s
Returns
negative value if if this view is less that the buf's view. zero the both view has the same sequences of the characters. posiative value if if this view is greater that the buf's view.

◆ compare() [7/9]

int async_mqtt::buffer::compare ( size_type pos1,
size_type count1,
std::string_view const & v ) const
inlineconstexprnoexcept

compare buffer Compare only the view.

Parameters
pos1start position of the this view
count1length of the this view
vtarget
Returns
negative value if if this view is less that the v's view. zero the both view has the same sequences of the characters. posiative value if if this view is greater that the v's view.

◆ compare() [8/9]

int async_mqtt::buffer::compare ( size_type pos1,
size_type count1,
std::string_view const & v,
size_type pos2,
size_type count2 ) const
inlineconstexprnoexcept

compare buffer Compare only the view.

Parameters
pos1start position of the this view
count1length of the this view
vtarget
pos2start position of the buf's view
count2length of the buf's view
Returns
negative value if if this view is less that the v's view. zero the both view has the same sequences of the characters. posiative value if if this view is greater that the v's view.

◆ compare() [9/9]

int async_mqtt::buffer::compare ( std::string_view const & v) const
inlineconstexprnoexcept

compare buffer Compare only the view.

Parameters
vtarget
Returns
negative value if if this view is less that the v's view. zero the both view has the same sequences of the characters. posiative value if if this view is greater that the v's view.

◆ copy()

size_type async_mqtt::buffer::copy ( char * dest,
size_type count,
size_type pos = 0 ) const
inline

copy the buffer characters

Parameters
destdestination
countcopy length
poscopy start position

◆ crbegin()

const_reverse_iterator async_mqtt::buffer::crbegin ( ) const
inlineconstexprnoexcept

get a reverse terator to the beginning

Returns
iterator

◆ crend()

const_reverse_iterator async_mqtt::buffer::crend ( ) const
inlineconstexprnoexcept

get a reverse terator to the end

Returns
iterator

◆ data()

const_pointer async_mqtt::buffer::data ( ) const
inlineconstexprnoexcept

get a pointer of the first character of the buffer

Returns
pointer

◆ empty()

bool async_mqtt::buffer::empty ( ) const
inlineconstexprnoexcept

checking the buffer is empty

Returns
true if the buffer is empty, otherwise false

◆ end()

const_iterator async_mqtt::buffer::end ( ) const
inlineconstexprnoexcept

get an iterator to the end

Returns
iterator

◆ find() [1/5]

size_type async_mqtt::buffer::find ( buffer const & buf,
size_type pos = 0 ) const
inlineconstexprnoexcept

find the first substring equal to the given view

Parameters
bufview to search for
posposition at which to start the search
Returns
position of the first character of the found substring, or npos if no such substring is found.

◆ find() [2/5]

size_type async_mqtt::buffer::find ( char ch,
size_type pos = 0 ) const
inlineconstexprnoexcept

find the first substring equal to the given view

Parameters
chcharacter to search for
posposition at which to start the search
Returns
position of the first character of the found substring, or npos if no such substring is found.

◆ find() [3/5]

size_type async_mqtt::buffer::find ( char const * s,
size_type pos,
size_type count ) const
inlineconstexpr

find the first substring equal to the given view

Parameters
spointer to a string of characters to search for
posposition at which to start the search
countlength of substring to search for
Returns
position of the first character of the found substring, or npos if no such substring is found.

◆ find() [4/5]

size_type async_mqtt::buffer::find ( char const * s,
size_type pos = 0 ) const
inlineconstexpr

find the first substring equal to the given view

Parameters
spointer to a string of characters to search for
posposition at which to start the search
Returns
position of the first character of the found substring, or npos if no such substring is found.

◆ find() [5/5]

size_type async_mqtt::buffer::find ( std::string_view v,
size_type pos = 0 ) const
inlineconstexprnoexcept

find the first substring equal to the given view

Parameters
vview to search for
posposition at which to start the search
Returns
position of the first character of the found substring, or npos if no such substring is found.

◆ find_first_not_of() [1/5]

size_type async_mqtt::buffer::find_first_not_of ( buffer const & buf,
size_type pos = 0 ) const
inlineconstexprnoexcept

find the first character not equal to any of the characters in the given view

Parameters
bufview to search for
posposition at which to start the search
Returns
position of the first character not equal to any of the characters in the given string, or npos if no such character is found.

◆ find_first_not_of() [2/5]

size_type async_mqtt::buffer::find_first_not_of ( char ch,
size_type pos = 0 ) const
inlineconstexprnoexcept

find the first character not equal to any of the characters in the given view

Parameters
chcharacter to search for
posposition at which to start the search
Returns
position of the first character not equal to any of the characters in the given string, or npos if no such character is found.

◆ find_first_not_of() [3/5]

size_type async_mqtt::buffer::find_first_not_of ( char const * s,
size_type pos,
size_type count ) const
inlineconstexpr

find the first character not equal to any of the characters in the given view

Parameters
sview to search for
posposition at which to start the search
countlength of the string of characters to compare
Returns
position of the first character not equal to any of the characters in the given string, or npos if no such character is found.

◆ find_first_not_of() [4/5]

size_type async_mqtt::buffer::find_first_not_of ( char const * s,
size_type pos = 0 ) const
inlineconstexpr

find the first character not equal to any of the characters in the given view

Parameters
spointer to a string of characters to compare
posposition at which to start the search
Returns
position of the first character not equal to any of the characters in the given string, or npos if no such character is found.

◆ find_first_not_of() [5/5]

size_type async_mqtt::buffer::find_first_not_of ( std::string_view v,
size_type pos = 0 ) const
inlineconstexprnoexcept

find the first character not equal to any of the characters in the given view

Parameters
vview to search for
posposition at which to start the search
Returns
position of the first character not equal to any of the characters in the given string, or npos if no such character is found.

◆ find_first_of() [1/5]

size_type async_mqtt::buffer::find_first_of ( buffer const & buf,
size_type pos = 0 ) const
inlineconstexprnoexcept

find the first character equal to any of the characters in the given view

Parameters
bufview to search for
posposition at which to start the search
Returns
position of the first occurrence of any character of the substring, or npos if no such character is found.

◆ find_first_of() [2/5]

size_type async_mqtt::buffer::find_first_of ( char ch,
size_type pos = 0 ) const
inlineconstexprnoexcept

find the first character equal to any of the characters in the given view

Parameters
chcharacter to search for
posposition at which to start the search
Returns
position of the first occurrence of any character of the substring, or npos if no such character is found.

◆ find_first_of() [3/5]

size_type async_mqtt::buffer::find_first_of ( char const * s,
size_type pos,
size_type count ) const
inlineconstexpr

find the first character equal to any of the characters in the given view

Parameters
spointer to a string of characters to search for
posposition at which to start the search
countlength of the string of characters to search for
Returns
position of the first occurrence of any character of the substring, or npos if no such character is found.

◆ find_first_of() [4/5]

size_type async_mqtt::buffer::find_first_of ( char const * s,
size_type pos = 0 ) const
inlineconstexpr

find the first character equal to any of the characters in the given view

Parameters
spointer to a string of characters to search for
posposition at which to start the search
Returns
position of the first occurrence of any character of the substring, or npos if no such character is found.

◆ find_first_of() [5/5]

size_type async_mqtt::buffer::find_first_of ( std::string_view v,
size_type pos = 0 ) const
inlineconstexprnoexcept

find the first character equal to any of the characters in the given view

Parameters
vview to search for
posposition at which to start the search
Returns
position of the first occurrence of any character of the substring, or npos if no such character is found.

◆ find_last_not_of() [1/5]

size_type async_mqtt::buffer::find_last_not_of ( buffer const & buf,
size_type pos = npos ) const
inlineconstexprnoexcept

find the last character not equal to any of the characters in the given view

Parameters
bufview to search for
posposition at which to start the search
Returns
position of the last character not equal to any of the characters in the given string, or npos if no such character is found.

◆ find_last_not_of() [2/5]

size_type async_mqtt::buffer::find_last_not_of ( char ch,
size_type pos = npos ) const
inlineconstexprnoexcept

find the last character not equal to any of the characters in the given view

Parameters
chcharacter to search for
posposition at which to start the search
Returns
position of the last character not equal to any of the characters in the given string, or npos if no such character is found.

◆ find_last_not_of() [3/5]

size_type async_mqtt::buffer::find_last_not_of ( char const * s,
size_type pos,
size_type count ) const
inlineconstexpr

find the last character not equal to any of the characters in the given view

Parameters
spointer to a string of characters to compare
posposition at which to start the search
countlength of the string of characters to compare
Returns
position of the last character not equal to any of the characters in the given string, or npos if no such character is found.

◆ find_last_not_of() [4/5]

size_type async_mqtt::buffer::find_last_not_of ( char const * s,
size_type pos = npos ) const
inlineconstexpr

find the last character not equal to any of the characters in the given view

Parameters
spointer to a string of characters to compare
posposition at which to start the search
Returns
position of the last character not equal to any of the characters in the given string, or npos if no such character is found.

◆ find_last_not_of() [5/5]

size_type async_mqtt::buffer::find_last_not_of ( std::string_view v,
size_type pos = npos ) const
inlineconstexprnoexcept

find the last character not equal to any of the characters in the given view

Parameters
vview to search for
posposition at which to start the search
Returns
position of the last character not equal to any of the characters in the given string, or npos if no such character is found.

◆ find_last_of() [1/5]

size_type async_mqtt::buffer::find_last_of ( buffer const & buf,
size_type pos = npos ) const
inlineconstexprnoexcept

find the last character equal to any of the characters in the given view

Parameters
bufview to search for
posposition at which to start the search
Returns
position of the last occurrence of any character of the substring, or npos if no such character is found.

◆ find_last_of() [2/5]

size_type async_mqtt::buffer::find_last_of ( char ch,
size_type pos = npos ) const
inlineconstexprnoexcept

find the last character equal to any of the characters in the given view

Parameters
chcharacter to search for
posposition at which to start the search
Returns
position of the last occurrence of any character of the substring, or npos if no such character is found.

◆ find_last_of() [3/5]

size_type async_mqtt::buffer::find_last_of ( char const * s,
size_type pos,
size_type count ) const
inlineconstexpr

find the last character equal to any of the characters in the given view

Parameters
spointer to a string of characters to search for
posposition at which to start the search
countlength of the string of characters to search for
Returns
position of the last occurrence of any character of the substring, or npos if no such character is found.

◆ find_last_of() [4/5]

size_type async_mqtt::buffer::find_last_of ( char const * s,
size_type pos = npos ) const
inlineconstexpr

find the last character equal to any of the characters in the given view

Parameters
spointer to a string of characters to search for
posposition at which to start the search
Returns
position of the last occurrence of any character of the substring, or npos if no such character is found.

◆ find_last_of() [5/5]

size_type async_mqtt::buffer::find_last_of ( std::string_view v,
size_type pos = npos ) const
inlineconstexprnoexcept

find the last character equal to any of the characters in the given view

Parameters
vview to search for
posposition at which to start the search
Returns
position of the last occurrence of any character of the substring, or npos if no such character is found.

◆ front()

const_reference async_mqtt::buffer::front ( ) const
inlineconstexpr

get a reference of the first character

Returns
reference of the character

◆ has_life()

bool async_mqtt::buffer::has_life ( ) const
inlinenoexcept

life checking

Returns
true if the buffer has life, otherwise false.

◆ length()

size_type async_mqtt::buffer::length ( ) const
inlineconstexprnoexcept

get the number of characters

Returns
the number of characters

◆ max_size()

size_type async_mqtt::buffer::max_size ( ) const
inlineconstexprnoexcept

get the largeset possible number of the buffer

Returns
the number of characters

◆ operator as::const_buffer()

async_mqtt::buffer::operator as::const_buffer ( ) const
inline

conversion operator to the buffer as asio const_buffer

Returns
asio boost::asio::const_buffer

◆ operator std::string_view()

async_mqtt::buffer::operator std::string_view ( ) const
inline

conversion operator to the buffer as asio const_buffer

Returns
asio std::string_view

◆ operator[]()

const_reference async_mqtt::buffer::operator[] ( size_type pos) const
inlineconstexpr

get a reference of the specific character

Parameters
posthe position of the character
Returns
reference of the character

◆ rbegin()

const_reverse_iterator async_mqtt::buffer::rbegin ( ) const
inlineconstexprnoexcept

get a reverse terator to the beginning

Returns
iterator

◆ remove_prefix()

void async_mqtt::buffer::remove_prefix ( size_type n)
inlineconstexpr

remove the first n characters from the buffer

Parameters
nremove length

◆ remove_suffix()

void async_mqtt::buffer::remove_suffix ( size_type n)
inlineconstexpr

remove the last n characters from the buffer

Parameters
nremove length

◆ rend()

const_reverse_iterator async_mqtt::buffer::rend ( ) const
inlineconstexprnoexcept

get a reverse terator to the end

Returns
iterator

◆ rfind() [1/5]

size_type async_mqtt::buffer::rfind ( buffer const & buf,
size_type pos = npos ) const
inlineconstexprnoexcept

find the last substring equal to the given view

Parameters
bufview to search for
posposition at which to start the search
Returns
position of the first character of the found substring or npos if no such substring is found.

◆ rfind() [2/5]

size_type async_mqtt::buffer::rfind ( char ch,
size_type pos = npos ) const
inlineconstexprnoexcept

find the last substring equal to the given view

Parameters
chcharacter to search for
posposition at which to start the search
Returns
position of the first character of the found substring or npos if no such substring is found.

◆ rfind() [3/5]

size_type async_mqtt::buffer::rfind ( char const * s,
size_type pos,
size_type count ) const
inlineconstexpr

find the last substring equal to the given view

Parameters
spointer to a string of characters to search for
posposition at which to start the search
countlength of substring to search for
Returns
position of the first character of the found substring or npos if no such substring is found.

◆ rfind() [4/5]

size_type async_mqtt::buffer::rfind ( char const * s,
size_type pos = npos ) const
inlineconstexpr

find the last substring equal to the given view

Parameters
spointer to a string of characters to search for
posposition at which to start the search
Returns
position of the first character of the found substring or npos if no such substring is found.

◆ rfind() [5/5]

size_type async_mqtt::buffer::rfind ( std::string_view v,
size_type pos = npos ) const
inlineconstexprnoexcept

find the last substring equal to the given view

Parameters
vview to search for
posposition at which to start the search
Returns
position of the first character of the found substring or npos if no such substring is found.

◆ size()

size_type async_mqtt::buffer::size ( ) const
inlineconstexprnoexcept

get the number of characters

Returns
the number of characters

◆ substr() [1/2]

buffer async_mqtt::buffer::substr ( size_type pos = 0,
size_type count = npos ) &&
inline

get substring The returned buffer ragnge is the same as std::string_view::substr(). In addition the lifetime is moved to returned buffer.

Parameters
posposition of the first character
countrequested length
Returns
buffer

◆ substr() [2/2]

buffer async_mqtt::buffer::substr ( size_type pos = 0,
size_type count = npos ) const &
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.

Parameters
posposition of the first character
countrequested length
Returns
buffer

◆ swap()

void async_mqtt::buffer::swap ( buffer & buf)
inlinenoexcept

swap the buffer

Parameters
buftarget

Friends And Related Symbol Documentation

◆ operator!=

bool operator!= ( buffer const & lhs,
buffer const & rhs )
friend

not equal operator comparison target is the view of the buffer. life holder is not compared.

Parameters
lhscompare target
rhscompare target
Returns
true if the lhs not equal to the rhs, otherwise false.

◆ operator<

bool operator< ( buffer const & lhs,
buffer const & rhs )
friend

less than operator comparison target is the view of the buffer. life holder is not compared.

Parameters
lhscompare target
rhscompare target
Returns
true if the lhs less than the rhs, otherwise false.

◆ operator<<

std::ostream & operator<< ( std::ostream & o,
buffer const & v )
friend

output to the stream

Parameters
ooutput stream
vtarget
Returns
output stream

◆ operator<=

bool operator<= ( buffer const & lhs,
buffer const & rhs )
friend

less than or equal to operator comparison target is the view of the buffer. life holder is not compared.

Parameters
lhscompare target
rhscompare target
Returns
true if the lhs less than or equal to the rhs, otherwise false.

◆ operator==

bool operator== ( buffer const & lhs,
buffer const & rhs )
friend

equal operator comparison target is the view of the buffer. life holder is not compared.

Parameters
lhscompare target
rhscompare target
Returns
true if the lhs equal to the rhs, otherwise false.

◆ operator>

bool operator> ( buffer const & lhs,
buffer const & rhs )
friend

greater than operator comparison target is the view of the buffer. life holder is not compared.

Parameters
lhscompare target
rhscompare target
Returns
true if the lhs greater than the rhs, otherwise false.

◆ operator>=

bool operator>= ( buffer const & lhs,
buffer const & rhs )
friend

greater than or equal to operator comparison target is the view of the buffer. life holder is not compared.

Parameters
lhscompare target
rhscompare target
Returns
true if the lhs greater than or equal to the rhs, otherwise false.

The documentation for this class was generated from the following file: