kanzi::ImmutableString Class Reference

Immutable string container. More...

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

Public Member Functions

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

Friends

void swap (ImmutableString &left, ImmutableString &right)
 Swap operation. 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...
 
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...
 

Detailed Description

Immutable string container.

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

Constructor & Destructor Documentation

kanzi::ImmutableString::ImmutableString ( )
inlineexplicit

Empty constructor.

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

Constructor.

Parameters
contentString to construct from.
kanzi::ImmutableString::ImmutableString ( KZ_RV_REF(ImmutableString other)
inline

Move constructor.

Parameters
otherSource string.

Member Function Documentation

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

Access string data.

Returns
C string.
kanzi::ImmutableString::operator string_view ( ) const
inline

string_view operator.

Returns
View to contained string.
ImmutableString& kanzi::ImmutableString::operator= ( KZ_RV_REF(ImmutableString other)
inline

Move operator.

Parameters
otherSource string.
Returns
This.

Friends And Related Function Documentation

void swap ( ImmutableString left,
ImmutableString right 
)
friend

Swap operation.

Parameters
leftLeft operand.
rightRight operand.
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.
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.
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.
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.
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.
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.
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: