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>
|
constexpr | buffer (string_view sv=string_view()) |
| string_view constructor More...
|
|
| buffer (std::string)=delete |
| string constructor (deleted) More...
|
|
| buffer (string_view sv, const_shared_ptr_array spa) |
| string_view and lifetime constructor More...
|
|
buffer | substr (std::size_t offset, std::size_t length=string_view::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. More...
|
|
buffer | substr (std::size_t offset, std::size_t length=string_view::npos) && |
| get substring The returned buffer ragnge is the same as std::string_view::substr(). In addition the lifetime is moved to returned buffer. More...
|
|
bool | has_life () const |
| check the buffer has lifetime. More...
|
|
buffer that has string_view interface This class provides string_view interface. This class hold string_view target's lifetime optionally.
◆ buffer() [1/3]
string_view constructor
- Parameters
-
sv | string_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]
MQTT_NS::buffer::buffer |
( |
std::string |
| ) |
|
|
explicitdelete |
string constructor (deleted)
- Parameters
-
string | This constructor is intentionally deleted. Consider buffer(std::string("ABC")) , the buffer points to dangling reference. |
◆ buffer() [3/3]
string_view and lifetime constructor
- Parameters
-
sv | string_view |
spa | shared_ptr_array that holds sv target's lifetime If user creates buffer via this constructor, spa's lifetime is held by the buffer. |
◆ has_life()
bool MQTT_NS::buffer::has_life |
( |
| ) |
const |
|
inline |
check the buffer has lifetime.
- Returns
- true the buffer has lifetime. false the buffer doesn't have lifetime, This means the buffer is a pure view.
◆ substr() [1/2]
buffer MQTT_NS::buffer::substr |
( |
std::size_t |
offset, |
|
|
std::size_t |
length = string_view::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
-
offset | offset point of the buffer |
length | length 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 MQTT_NS::buffer::substr |
( |
std::size_t |
offset, |
|
|
std::size_t |
length = string_view::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
-
offset | offset point of the buffer |
length | length 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: