Kanzi  3.9.7
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) noexcept
 Move constructor. More...
 
 operator string_view () const
 string_view operator. More...
 
ImmutableStringoperator= (ImmutableString &&other) noexcept
 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

kanzi::ImmutableString::ImmutableString ( )
explicitdefault

Empty constructor.

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

Constructor.

Parameters
contentString to construct from.
kanzi::ImmutableString::ImmutableString ( ImmutableString &&  other)
inlinenoexcept

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= ( ImmutableString &&  other)
inlinenoexcept

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: