Tkrzw
|
Wrapper of string_view of allocated memory. More...
#include <tkrzw_str_util.h>
Public Member Functions | |
ScopedStringView () | |
Constructor. More... | |
ScopedStringView (void *buf, size_t size) | |
Constructor. More... | |
ScopedStringView (std::string_view str) | |
Constructor. More... | |
~ScopedStringView () | |
Destructor. More... | |
std::string_view | Get () const |
Gets the string view object. More... | |
void | Set (void *buf, size_t size) |
Sets the data. More... | |
void | Set (std::string_view str) |
Sets the data by a string view. More... | |
Wrapper of string_view of allocated memory.
tkrzw::ScopedStringView::ScopedStringView | ( | ) |
Constructor.
tkrzw::ScopedStringView::ScopedStringView | ( | void * | buf, |
size_t | size | ||
) |
Constructor.
buf | The pointer to a region allocated by xmalloc. The ownership of is taken. |
size | The size of the region. |
|
explicit |
Constructor.
str | A string view object whose data is allocated by xmalloc. The ownership of the data is taken. |
tkrzw::ScopedStringView::~ScopedStringView | ( | ) |
Destructor.
std::string_view tkrzw::ScopedStringView::Get | ( | ) | const |
Gets the string view object.
void tkrzw::ScopedStringView::Set | ( | void * | buf, |
size_t | size | ||
) |
Sets the data.
The region of the old data is released.
void tkrzw::ScopedStringView::Set | ( | std::string_view | str | ) |
Sets the data by a string view.
The region of the old data is released.