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

Static Public Member Functions

static void clearDict ()
 Clear the global dictionary.
 

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.