ICU 78.1
78.1
|
"Smart pointer" base class; do not use directly: use LocalPointer etc. More...
#include <localpointer.h>
Public Member Functions | |
LocalPointerBase (T *p=nullptr) | |
Constructor takes ownership. More... | |
~LocalPointerBase () | |
Destructor deletes the object it owns. More... | |
UBool | isNull () const |
nullptr check. More... | |
UBool | isValid () const |
nullptr check. More... | |
bool | operator== (const T *other) const |
Comparison with a simple pointer, so that existing code with ==nullptr need not be changed. More... | |
bool | operator!= (const T *other) const |
Comparison with a simple pointer, so that existing code with !=nullptr need not be changed. More... | |
T * | getAlias () const |
Access without ownership change. More... | |
T & | operator* () const |
Access without ownership change. More... | |
T * | operator-> () const |
Access without ownership change. More... | |
T * | orphan () |
Gives up ownership; the internal pointer becomes nullptr. More... | |
void | adoptInstead (T *p) |
Deletes the object it owns, and adopts (takes ownership of) the one passed in. More... | |
Static Public Member Functions | |
static void * | operator new (size_t)=delete |
static void * | operator new[] (size_t)=delete |
static void * | operator new (size_t, void *)=delete |
Protected Attributes | |
T * | ptr |
Actual pointer. More... | |
"Smart pointer" base class; do not use directly: use LocalPointer etc.
Base class for smart pointer classes that do not throw exceptions.
Do not use this base class directly, since it does not delete its pointer. A subclass must implement methods that delete the pointer: Destructor and adoptInstead().
There is no operator T *() provided because the programmer must decide whether to use getAlias() (without transfer of ownership) or orphan() (with transfer of ownership and NULLing of the pointer).
Definition at line 68 of file localpointer.h.
|
inlineexplicit |
Constructor takes ownership.
p | simple pointer to an object that is adopted |
Definition at line 80 of file localpointer.h.
|
inline |
Destructor deletes the object it owns.
Subclass must override: Base class does nothing.
Definition at line 86 of file localpointer.h.
|
inline |
Deletes the object it owns, and adopts (takes ownership of) the one passed in.
Subclass must override: Base class does not delete the object.
p | simple pointer to an object that is adopted |
Definition at line 151 of file localpointer.h.
|
inline |
Access without ownership change.
Definition at line 120 of file localpointer.h.
|
inline |
nullptr check.
Definition at line 92 of file localpointer.h.
Referenced by icu::Locale::getKeywords(), and icu::Locale::getUnicodeKeywords().
|
inline |
nullptr check.
Definition at line 98 of file localpointer.h.
|
inline |
Comparison with a simple pointer, so that existing code with !=nullptr need not be changed.
other | simple pointer for comparison |
Definition at line 114 of file localpointer.h.
|
inline |
Access without ownership change.
Definition at line 126 of file localpointer.h.
|
inline |
Access without ownership change.
Definition at line 132 of file localpointer.h.
|
inline |
Comparison with a simple pointer, so that existing code with ==nullptr need not be changed.
other | simple pointer for comparison |
Definition at line 106 of file localpointer.h.
|
inline |
Gives up ownership; the internal pointer becomes nullptr.
Definition at line 139 of file localpointer.h.
|
protected |
Actual pointer.
Definition at line 160 of file localpointer.h.
Referenced by icu::LocalArray< T >::LocalArray(), icu::LocalPointer< T >::LocalPointer(), icu::LocalArray< T >::operator=(), icu::LocalPointer< T >::operator=(), icu::LocalArray< T >::swap(), and icu::LocalPointer< T >::swap().