async_mqtt 5.0.0
Loading...
Searching...
No Matches
async_mqtt::buffer Class Reference

buffer that has string_view interface This class provides string_view interface. This class hold string_view target's lifetime optionally. More...

#include <buffer.hpp>

Public Member Functions

constexpr buffer (string_view sv)
 string_view constructor
 
 buffer (std::string)=delete
 string constructor (deleted)
 
 buffer (string_view sv, any life)
 string_view and lifetime constructor
 
buffer substr (size_type pos=0, size_type count=npos) const &
 get substring The returned buffer ragnge is the same as 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 string_view::substr(). In addition the lifetime is moved to returned buffer.
 

Detailed Description

buffer that has string_view interface This class provides string_view interface. This class hold string_view target's lifetime optionally.

Constructor & Destructor Documentation

◆ buffer() [1/3]

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

string_view constructor

Parameters
svstring_view This constructor doesn't hold the sv target's lifetime. It behaves as string_view. Caller needs to manage the target lifetime.

◆ buffer() [2/3]

async_mqtt::buffer::buffer ( std::string )
explicitdelete

string constructor (deleted)

Parameters
stringThis constructor is intentionally deleted. Consider buffer(std::string("ABC")), the buffer points to dangling reference.

◆ buffer() [3/3]

async_mqtt::buffer::buffer ( string_view sv,
any life )
inline

string_view and lifetime constructor

Parameters
svstring_view
spshared_ptr_array that holds sv target's lifetime If user creates buffer via this constructor, sp's lifetime is held by the buffer.

Member Function Documentation

◆ 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 string_view::substr(). In addition the lifetime is moved to returned buffer.

Parameters
offsetoffset point of the buffer
lengthlength of the buffer, If the length is string_view::npos then the length is from offset to the end of string.

◆ 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 string_view::substr(). In addition the lifetime is shared between returned buffer and this buffer.

Parameters
offsetoffset point of the buffer
lengthlength of the buffer, If the length is string_view::npos then the length is from offset to the end of string.

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