Kanzi Framework  3.9.0
Kanzi Engine API
kanzi::ImmutableString Class Reference

Immutable string container. More...

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

Public Member Functions

const char * c_str () const
 Access string data. More...
 
 ImmutableString ()=default
 Empty constructor. More...
 
 ImmutableString (string_view content)
 Constructor. More...
 
 ImmutableString (ImmutableString &&other)
 Move constructor. More...
 
 operator string_view () const
 string_view operator. More...
 
ImmutableStringoperator= (ImmutableString &&other)
 Move operator. More...
 

Friends

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

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)
inline

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)
inline

Move operator.

Parameters
otherSource string.
Returns
This.

Friends And Related Function 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]

bool operator== ( const ImmutableString 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!= [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]

bool operator!= ( const ImmutableString 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<

bool operator< ( const ImmutableString lhs,
const ImmutableString rhs 
)
friend

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: