Kanzi 3.9.10
kanzi::ImmutableString Class Reference

Immutable string container. More...

#include <kanzi/core/string/immutable_string.hpp>

Public Member Functions

const charc_str () const
 Access string data.
 
 ImmutableString ()=default
 Empty constructor.
 
 ImmutableString (ImmutableString &&other) noexcept
 Move constructor.
 
 ImmutableString (string_view content)
 Constructor.
 
 operator string_view () const
 string_view operator.
 
ImmutableStringoperator= (ImmutableString &&other) noexcept
 Move operator.
 

Friends

bool operator!= (const ImmutableString &lhs, const ImmutableString &rhs)
 Not equals operator.
 
bool operator!= (const ImmutableString &lhs, string_view rhs)
 Not equals operator.
 
bool operator!= (string_view lhs, const ImmutableString &rhs)
 Not equals operator.
 
bool operator< (const ImmutableString &lhs, const ImmutableString &rhs)
 Less than operator.
 
bool operator== (const ImmutableString &lhs, const ImmutableString &rhs)
 Comparison operator.
 
bool operator== (const ImmutableString &lhs, string_view rhs)
 Comparison operator.
 
bool operator== (string_view lhs, const ImmutableString &rhs)
 Comparison operator.
 
void swap (ImmutableString &left, ImmutableString &right)
 Swap operation.
 

Detailed Description

Immutable string container.

Represents a string that is allocated dynamically but cannot be changed.

Constructor & Destructor Documentation

◆ ImmutableString() [1/3]

kanzi::ImmutableString::ImmutableString ( )
explicitdefault

Empty constructor.

◆ ImmutableString() [2/3]

kanzi::ImmutableString::ImmutableString ( string_view content)
inlineexplicit

Constructor.

Parameters
contentString to construct from.

◆ ImmutableString() [3/3]

kanzi::ImmutableString::ImmutableString ( ImmutableString && other)
inlinenoexcept

Move constructor.

Parameters
otherSource string.

Member Function Documentation

◆ c_str()

const char * kanzi::ImmutableString::c_str ( ) const
inline

Access string data.

Returns
C string.

◆ operator string_view()

kanzi::ImmutableString::operator string_view ( ) const
inline

string_view operator.

Returns
View to contained string.

◆ operator=()

ImmutableString & kanzi::ImmutableString::operator= ( ImmutableString && other)
inlinenoexcept

Move operator.

Parameters
otherSource string.
Returns
This.

Friends And Related Symbol Documentation

◆ swap

void swap ( ImmutableString & left,
ImmutableString & right )
friend

Swap operation.

Parameters
leftLeft operand.
rightRight operand.

◆ operator== [1/3]

bool operator== ( const ImmutableString & lhs,
string_view rhs )
friend

Comparison operator.

Parameters
lhsLeft-hand side operand.
rhsRight-hand side operand.
Returns
True if equal, false if not equal.

◆ operator== [2/3]

bool operator== ( string_view lhs,
const ImmutableString & rhs )
friend

Comparison operator.

Parameters
lhsLeft-hand side operand.
rhsRight-hand side operand.
Returns
True if equal, false if not equal.

◆ operator== [3/3]

Comparison operator.

Parameters
lhsLeft-hand side operand.
rhsRight-hand side operand.
Returns
True if equal, false if not equal.

◆ operator!= [1/3]

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

Not equals operator.

Parameters
lhsLeft-hand side operand.
rhsRight-hand side operand.
Returns
True if not equal, false if equal.

◆ operator!= [2/3]

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

Not equals operator.

Parameters
lhsLeft-hand side operand.
rhsRight-hand side operand.
Returns
True if not equal, false if equal.

◆ operator!= [3/3]

Not equals operator.

Parameters
lhsLeft-hand side operand.
rhsRight-hand side operand.
Returns
True if not equal, false if equal.

◆ operator<

Less than operator.

Parameters
lhsLeft-hand side operand.
rhsRight-hand side operand.
Returns
True if lhs is lexically 'smaller' than rhs, false otherwise.

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