Tkrzw
tkrzw::NullableStringView Class Reference

Simplified string_view to convey nullptr and be modifiable. More...

#include <tkrzw_str_util.h>

Public Member Functions

 NullableStringView ()
 Constructor for an undefined region.
 
 NullableStringView (const char *str)
 Constructor for a C-string.
 
 NullableStringView (const char *data, size_t size)
 Constructor for a specific region.
 
 NullableStringView (const std::string &str)
 Constructor for a string object.
 
 NullableStringView (const std::string_view &str)
 Constructor for a string view object.
 
const char * data () const
 Gets the pointer to the data region.
 
size_t size () const
 Gets the size of the region.
 
std::string_view Get () const
 Gets the string_view object.
 
void Set (const char *data, size_t size)
 Sets the data.
 
void Set (std::string_view str)
 Sets the data by a string view.
 

Detailed Description

Simplified string_view to convey nullptr and be modifiable.

Constructor & Destructor Documentation

◆ NullableStringView() [1/5]

tkrzw::NullableStringView::NullableStringView ( )

Constructor for an undefined region.

◆ NullableStringView() [2/5]

tkrzw::NullableStringView::NullableStringView ( const char * str)
explicit

Constructor for a C-string.

◆ NullableStringView() [3/5]

tkrzw::NullableStringView::NullableStringView ( const char * data,
size_t size )

Constructor for a specific region.

◆ NullableStringView() [4/5]

tkrzw::NullableStringView::NullableStringView ( const std::string & str)
explicit

Constructor for a string object.

◆ NullableStringView() [5/5]

tkrzw::NullableStringView::NullableStringView ( const std::string_view & str)
explicit

Constructor for a string view object.

Member Function Documentation

◆ data()

const char * tkrzw::NullableStringView::data ( ) const

Gets the pointer to the data region.

◆ size()

size_t tkrzw::NullableStringView::size ( ) const

Gets the size of the region.

◆ Get()

std::string_view tkrzw::NullableStringView::Get ( ) const

Gets the string_view object.

◆ Set() [1/2]

void tkrzw::NullableStringView::Set ( const char * data,
size_t size )

Sets the data.

◆ Set() [2/2]

void tkrzw::NullableStringView::Set ( std::string_view str)

Sets the data by a string view.