PUMA Library Reference Manual
Loading...
Searching...
No Matches
Puma::DString Class Reference

#include <Puma/DString.h>

Description

Global dictionary based string container.

Public Member Functions

 DString ()
 Construct an empty string container. More...
 
 DString (const char *str)
 Construct a new string container for the given string. More...
 
 DString (const DString &copy)
 Copy a string container. More...
 
 ~DString ()
 Destroy the container. More...
 
DStringoperator= (const DString &copy)
 Copy a string container. More...
 
DStringoperator= (const char *str)
 Assign a string to this string container. More...
 
bool operator== (const DString &str) const
 Check if the given string equals this string. More...
 
bool operator!= (const DString &str) const
 Check if the given string not equals this string. More...
 
const char * c_str () const
 Get the contained string. More...
 
unsigned int length () const
 Get the length of the string. More...
 
bool empty () const
 Check if the string is empty. More...
 
unsigned int magic () const
 Get the magic number (hash) of the string. More...
 
 operator const char * () const
 Conversion operator returning the contained string. More...
 

Static Public Member Functions

static void clearDict ()
 Clear the global dictionary. More...
 

Constructor & Destructor Documentation

◆ DString() [1/3]

Puma::DString::DString ( )
inline

Construct an empty string container.

Refers to the empty string.

◆ DString() [2/3]

Puma::DString::DString ( const char *  str)
inline

Construct a new string container for the given string.

If the string is not null, then it is inserted into the dictionary.

Parameters
strThe string.

◆ DString() [3/3]

Puma::DString::DString ( const DString copy)
inline

Copy a string container.

Parameters
copyThe string container to copy.

◆ ~DString()

Puma::DString::~DString ( )
inline

Destroy the container.

Does not delete the string.

Member Function Documentation

◆ c_str()

const char * Puma::DString::c_str ( ) const
inline

Get the contained string.

Returns
A pointer to the contained string.

◆ clearDict()

static void Puma::DString::clearDict ( )
inlinestatic

Clear the global dictionary.

◆ empty()

bool Puma::DString::empty ( ) const
inline

Check if the string is empty.

The string is empty if its length is zero.

Returns
True if the string is empty.

◆ length()

unsigned int Puma::DString::length ( ) const
inline

Get the length of the string.

Returns
The length of the contained string.

◆ magic()

unsigned int Puma::DString::magic ( ) const
inline

Get the magic number (hash) of the string.

Returns
The magic number.

◆ operator const char *()

Puma::DString::operator const char * ( ) const
inline

Conversion operator returning the contained string.

Returns
A pointer to the contained string.

◆ operator!=()

bool Puma::DString::operator!= ( const DString str) const
inline

Check if the given string not equals this string.

Parameters
strThe string to compare with.

◆ operator=() [1/2]

DString & Puma::DString::operator= ( const char *  str)
inline

Assign a string to this string container.

Parameters
strThe string.

◆ operator=() [2/2]

DString & Puma::DString::operator= ( const DString copy)
inline

Copy a string container.

Parameters
copyThe string container to copy.

◆ operator==()

bool Puma::DString::operator== ( const DString str) const
inline

Check if the given string equals this string.

Parameters
strThe string to compare with.