sptk2 logo
SPTK Home Page

sptk::CSharedStrings Class Reference
[Utility Classes]

Shared strings table. More...

#include <CSharedStrings.h>

Inheritance diagram for sptk::CSharedStrings:

sptk::CXmlDoc sptk::CRegistry

List of all members.

Public Member Functions

 CSharedStrings ()
 Default constructor.
 ~CSharedStrings ()
 Destructor.
const std::string & shareString (const char *str)
 Obtain a shared string.
const std::string & shareString (const std::string &str)
 Obtain a shared string.
void releaseString (const char *str) throw (std::exception)
 Releases a shared string.
void releaseString (const std::string &str) throw (std::exception)
 Releases a shared string.
void clear ()
 Clears the shared string table.


Detailed Description

Shared strings table.

Contains a table of shared strings for the use with different objects such as XML node, ListView, etc


Member Function Documentation

void sptk::CSharedStrings::clear (  ) 

Clears the shared string table.

Only the string containing the empty string ("") is left after this operation

Reimplemented in sptk::CXmlDoc.

Referenced by ~CSharedStrings().

void sptk::CSharedStrings::releaseString ( const std::string &  str  )  throw (std::exception) [inline]

Releases a shared string.

If the shared string reference counter is greater than one, it's decreased by one. If the reference counter is one, the string is removed from SST. If the string doesn't exist, the exception is thrown.

Parameters:
str const std::string&, a string to release

References releaseString().

void sptk::CSharedStrings::releaseString ( const char *  str  )  throw (std::exception)

Releases a shared string.

If the shared string reference counter is greater than one, it's decreased by one. If the reference counter is one, the string is removed from SST. If the string doesn't exist, the exception is thrown.

Parameters:
str const char *, a string to release

Referenced by releaseString().

const std::string& sptk::CSharedStrings::shareString ( const std::string &  str  )  [inline]

Obtain a shared string.

Looks for an existing shared string, and returns a const char *pointer to it. If a shared string not found, it's created with reference count one. For an existing shared string, every call of this method encreases string reference counter by one

Parameters:
str const std::string&, a string to share

References shareString().

const std::string& sptk::CSharedStrings::shareString ( const char *  str  ) 

Obtain a shared string.

Looks for an existing shared string, and returns a const std::string& to it. If a shared string not found, it's created with reference count one. For an existing shared string, every call of this method encreases string reference counter by one

Parameters:
str const char *, a string to share

Referenced by shareString().


The documentation for this class was generated from the following file:

Mon Mar 5 11:56:06 2012: SPTK 3.5.7