17 #ifndef __LOCALPOINTER_H__
18 #define __LOCALPOINTER_H__
41 #if U_SHOW_CPLUSPLUS_API
97 bool operator==(
const T *other)
const {
return ptr==other; }
160 static void * U_EXPORT2
operator new(
size_t size);
161 static void * U_EXPORT2
operator new[](
size_t size);
162 #if U_HAVE_PLACEMENT_NEW
163 static void * U_EXPORT2
operator new(size_t,
void *ptr);
290 #define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction) \
291 class LocalPointerClassName : public LocalPointerBase<Type> { \
293 explicit LocalPointerClassName(Type *p=NULL) : LocalPointerBase<Type>(p) {} \
294 ~LocalPointerClassName() { closeFunction(ptr); } \
295 void adoptInstead(Type *p) { \
296 closeFunction(ptr); \
void adoptInstead(T *p)
Deletes the object it owns, and adopts (takes ownership of) the one passed in.
bool operator==(const T *other) const
Comparison with a simple pointer, so that existing code with ==NULL need not be changed.
LocalArray(T *p=NULL)
Constructor takes ownership.
T * getAlias() const
Access without ownership change.
T * operator->() const
Access without ownership change.
"Smart pointer" class, deletes objects via the standard C++ delete operator.
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
UBool isNull() const
NULL check.
T & operator*() const
Access without ownership change.
LocalPointer(T *p=NULL)
Constructor takes ownership.
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
T * orphan()
Gives up ownership; the internal pointer becomes NULL.
LocalPointerBase(T *p=NULL)
Constructor takes ownership.
"Smart pointer" base class; do not use directly: use LocalPointer etc.
UBool operator!=(const StringPiece &x, const StringPiece &y)
Global operator != for StringPiece.
#define NULL
Define NULL if necessary, to 0 for C++ and to ((void *)0) for C.
"Smart pointer" class, deletes objects via the C++ array delete[] operator.
~LocalPointer()
Destructor deletes the object it owns.
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
void adoptInstead(T *p)
Deletes the array it owns, and adopts (takes ownership of) the one passed in.
bool operator!=(const T *other) const
Comparison with a simple pointer, so that existing code with !=NULL need not be changed.
~LocalArray()
Destructor deletes the array it owns.
~LocalPointerBase()
Destructor deletes the object it owns.
Basic definitions for ICU, for both C and C++ APIs.
UBool isValid() const
NULL check.
void adoptInstead(T *p)
Deletes the object it owns, and adopts (takes ownership of) the one passed in.
T & operator[](ptrdiff_t i) const
Array item access (writable).
int8_t UBool
The ICU boolean type.