RefCountedString_t Class Reference

Reference counted string which deletes itself when the reference count reaches zero. More...

#include <UTString.h>

Inheritance diagram for RefCountedString_t:
String_t Buffer_t

List of all members.

Public Member Functions

 RefCountedString_t (const utf8 *string)
 RefCountedString_t (stringliteral *string)
 RefCountedString_t (const String_t &copy)
void AddReference ()
void RemoveReference ()

Detailed Description

Reference counted string which deletes itself when the reference count reaches zero. The implementation is thread safe, using atomic addition for managing the reference count. Once references have been added, modification of the string is not thread safe. Only the reference counting mechanism is thread safe. A reference counted string should never be created on the stack.

Definition at line 948 of file UTString.h.


Constructor & Destructor Documentation

RefCountedString_t::RefCountedString_t ( const utf8 string  )  [inline]

String which copies a UTF8 string fully independent of the original; const string pointers are not borrowed, therefore a copied string becomes fully autonomous. A single reference is implicitly added when the reference counted string is constructed.

Definition at line 1616 of file UTString.h.

RefCountedString_t::RefCountedString_t ( stringliteral string  )  [inline]

String which persistently references a string literal; the pointer is borrowed. Therefore the string object is dependent on the pointer with which it was constructed. The contents of that pointer must remain valid for the life of the string object. Any manipulation of the string will cause the contents to be copied to a dynamically allocated buffer. At that point, the string object will no longer be dependent on the contents of the string literal constant. A single reference is implicitly added when the reference counted string is constructed.

Definition at line 1624 of file UTString.h.

RefCountedString_t::RefCountedString_t ( const String_t copy  )  [inline]

Copy constructor, which creates a string fully independent of the original; const string pointers are not borrowed, therefore a copied string becomes fully autonomous. A single reference is implicitly added when the reference counted string is constructed.

Definition at line 1632 of file UTString.h.


Member Function Documentation

void RefCountedString_t::AddReference (  )  [inline]

Increments the reference count. The RefCountedString_t object will persist until the reference count reaches zero by calls to RemoveReference. The implementation is thread safe, using atomic addition for managing the reference count.

Definition at line 1640 of file UTString.h.

void RefCountedString_t::RemoveReference (  )  [inline]

Decrements the reference count. When the reference count reaches zero, the reference counted string will be deleted. The RefCountedString_t object will persist until the reference count reaches zero by calls to RemoveReference. The implementation is thread safe, using atomic addition for managing the reference count.

Definition at line 1647 of file UTString.h.


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

Generated on Tue Dec 14 22:35:07 2010 for UT library by  doxygen 1.6.1