ICU 52.1
52.1
|
"Smart pointer" class, deletes objects via the standard C++ delete operator. More...
#include <localpointer.h>
Public Member Functions | |
LocalPointer (T *p=NULL) | |
Constructor takes ownership. | |
~LocalPointer () | |
Destructor deletes the object it owns. | |
void | adoptInstead (T *p) |
Deletes the object it owns, and adopts (takes ownership of) the one passed in. | |
![]() | |
LocalPointerBase (T *p=NULL) | |
Constructor takes ownership. | |
~LocalPointerBase () | |
Destructor deletes the object it owns. | |
UBool | isNull () const |
NULL check. | |
UBool | isValid () const |
NULL check. | |
bool | operator== (const T *other) const |
Comparison with a simple pointer, so that existing code with ==NULL need not be changed. | |
bool | operator!= (const T *other) const |
Comparison with a simple pointer, so that existing code with !=NULL need not be changed. | |
T * | getAlias () const |
Access without ownership change. | |
T & | operator* () const |
Access without ownership change. | |
T * | operator-> () const |
Access without ownership change. | |
T * | orphan () |
Gives up ownership; the internal pointer becomes NULL. |
Additional Inherited Members | |
![]() | |
T * | ptr |
Actual pointer. |
"Smart pointer" class, deletes objects via the standard C++ delete operator.
For most methods see the LocalPointerBase base class.
Usage example:
Definition at line 186 of file localpointer.h.
|
inlineexplicit |
Constructor takes ownership.
p | simple pointer to an object that is adopted |
Definition at line 193 of file localpointer.h.
|
inline |
Destructor deletes the object it owns.
Definition at line 198 of file localpointer.h.
|
inline |
Deletes the object it owns, and adopts (takes ownership of) the one passed in.
p | simple pointer to an object that is adopted |
Reimplemented from icu::LocalPointerBase< T >.
Definition at line 207 of file localpointer.h.