mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 08:53:20 +00:00
ICU-8155 Promote LocalPointer[Base]/LocalArray/U_DEFINE_LOCAL_OPEN_POINTER from @draft 4.4 to @stable
X-SVN-Rev: 29050
This commit is contained in:
parent
5f278a0b62
commit
b9cfe4aa5b
27 changed files with 54 additions and 54 deletions
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2009, International Business Machines
|
||||
* Copyright (C) 2009-2010, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -58,7 +58,7 @@ U_NAMESPACE_BEGIN
|
|||
* @see LocalPointer
|
||||
* @see LocalArray
|
||||
* @see U_DEFINE_LOCAL_OPEN_POINTER
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
template<typename T>
|
||||
class LocalPointerBase {
|
||||
|
@ -66,25 +66,25 @@ public:
|
|||
/**
|
||||
* Constructor takes ownership.
|
||||
* @param p simple pointer to an object that is adopted
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
explicit LocalPointerBase(T *p=NULL) : ptr(p) {}
|
||||
/**
|
||||
* Destructor deletes the object it owns.
|
||||
* Subclass must override: Base class does nothing.
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
~LocalPointerBase() { /* delete ptr; */ }
|
||||
/**
|
||||
* NULL check.
|
||||
* @return TRUE if ==NULL
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
UBool isNull() const { return ptr==NULL; }
|
||||
/**
|
||||
* NULL check.
|
||||
* @return TRUE if !=NULL
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
UBool isValid() const { return ptr!=NULL; }
|
||||
/**
|
||||
|
@ -92,7 +92,7 @@ public:
|
|||
* with ==NULL need not be changed.
|
||||
* @param other simple pointer for comparison
|
||||
* @return true if this pointer value equals other
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
bool operator==(const T *other) const { return ptr==other; }
|
||||
/**
|
||||
|
@ -100,32 +100,32 @@ public:
|
|||
* with !=NULL need not be changed.
|
||||
* @param other simple pointer for comparison
|
||||
* @return true if this pointer value differs from other
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
bool operator!=(const T *other) const { return ptr!=other; }
|
||||
/**
|
||||
* Access without ownership change.
|
||||
* @return the pointer value
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
T *getAlias() const { return ptr; }
|
||||
/**
|
||||
* Access without ownership change.
|
||||
* @return the pointer value as a reference
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
T &operator*() const { return *ptr; }
|
||||
/**
|
||||
* Access without ownership change.
|
||||
* @return the pointer value
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
T *operator->() const { return ptr; }
|
||||
/**
|
||||
* Gives up ownership; the internal pointer becomes NULL.
|
||||
* @return the pointer value;
|
||||
* caller becomes responsible for deleting the object
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
T *orphan() {
|
||||
T *p=ptr;
|
||||
|
@ -137,7 +137,7 @@ public:
|
|||
* and adopts (takes ownership of) the one passed in.
|
||||
* Subclass must override: Base class does not delete the object.
|
||||
* @param p simple pointer to an object that is adopted
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
void adoptInstead(T *p) {
|
||||
// delete ptr;
|
||||
|
@ -176,7 +176,7 @@ private:
|
|||
* \endcode
|
||||
*
|
||||
* @see LocalPointerBase
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
template<typename T>
|
||||
class LocalPointer : public LocalPointerBase<T> {
|
||||
|
@ -184,12 +184,12 @@ public:
|
|||
/**
|
||||
* Constructor takes ownership.
|
||||
* @param p simple pointer to an object that is adopted
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
explicit LocalPointer(T *p=NULL) : LocalPointerBase<T>(p) {}
|
||||
/**
|
||||
* Destructor deletes the object it owns.
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
~LocalPointer() {
|
||||
delete LocalPointerBase<T>::ptr;
|
||||
|
@ -198,7 +198,7 @@ public:
|
|||
* Deletes the object it owns,
|
||||
* and adopts (takes ownership of) the one passed in.
|
||||
* @param p simple pointer to an object that is adopted
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
void adoptInstead(T *p) {
|
||||
delete LocalPointerBase<T>::ptr;
|
||||
|
@ -222,7 +222,7 @@ public:
|
|||
* \endcode
|
||||
*
|
||||
* @see LocalPointerBase
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
template<typename T>
|
||||
class LocalArray : public LocalPointerBase<T> {
|
||||
|
@ -230,12 +230,12 @@ public:
|
|||
/**
|
||||
* Constructor takes ownership.
|
||||
* @param p simple pointer to an array of T objects that is adopted
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
explicit LocalArray(T *p=NULL) : LocalPointerBase<T>(p) {}
|
||||
/**
|
||||
* Destructor deletes the array it owns.
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
~LocalArray() {
|
||||
delete[] LocalPointerBase<T>::ptr;
|
||||
|
@ -244,7 +244,7 @@ public:
|
|||
* Deletes the array it owns,
|
||||
* and adopts (takes ownership of) the one passed in.
|
||||
* @param p simple pointer to an array of T objects that is adopted
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
void adoptInstead(T *p) {
|
||||
delete[] LocalPointerBase<T>::ptr;
|
||||
|
@ -255,7 +255,7 @@ public:
|
|||
* No index bounds check.
|
||||
* @param i array index
|
||||
* @return reference to the array item
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
T &operator[](ptrdiff_t i) const { return LocalPointerBase<T>::ptr[i]; }
|
||||
};
|
||||
|
@ -281,7 +281,7 @@ public:
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction) \
|
||||
class LocalPointerClassName : public LocalPointerBase<Type> { \
|
||||
|
|
|
@ -563,7 +563,7 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalUBiDiPointer, UBiDi, ubidi_close);
|
||||
|
||||
|
|
|
@ -289,7 +289,7 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalUBreakIteratorPointer, UBreakIterator, ubrk_close);
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalUCaseMapPointer, UCaseMap, ucasemap_close);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
**********************************************************************
|
||||
* Copyright (C) 1999-2009, International Business Machines
|
||||
* Copyright (C) 1999-2010, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
* ucnv.h:
|
||||
|
@ -535,7 +535,7 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterPointer, UConverter, ucnv_close);
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterSelectorPointer, UConverterSelector, ucnvsel_close);
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalUDataMemoryPointer, UDataMemory, udata_close);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2002-2009, International Business Machines
|
||||
* Copyright (C) 2002-2010, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -59,7 +59,7 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalUEnumerationPointer, UEnumeration, uenum_close);
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalUNormalizer2Pointer, UNormalizer2, unorm2_close);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
**********************************************************************
|
||||
* Copyright (C) 1997-2009, International Business Machines
|
||||
* Copyright (C) 1997-2010, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
*
|
||||
|
@ -250,7 +250,7 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalUResourceBundlePointer, UResourceBundle, ures_close);
|
||||
|
||||
|
|
|
@ -311,7 +311,7 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalUSetPointer, USet, uset_close);
|
||||
|
||||
|
|
|
@ -218,7 +218,7 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalUStringPrepProfilePointer, UStringPrepProfile, usprep_close);
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalUTextPointer, UText, utext_close);
|
||||
|
||||
|
|
|
@ -656,7 +656,7 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalUCalendarPointer, UCalendar, ucal_close);
|
||||
|
||||
|
|
|
@ -405,7 +405,7 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalUCollatorPointer, UCollator, ucol_close);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
**********************************************************************
|
||||
* Copyright (C) 2005-2009, International Business Machines
|
||||
* Copyright (C) 2005-2010, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
* file name: ucsdet.h
|
||||
|
@ -95,7 +95,7 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalUCharsetDetectorPointer, UCharsetDetector, ucsdet_close);
|
||||
|
||||
|
|
|
@ -561,7 +561,7 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateFormatPointer, UDateFormat, udat_close);
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateTimePatternGeneratorPointer, UDateTimePatternGenerator, udatpg_close);
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalULocaleDisplayNamesPointer, ULocaleDisplayNames, uldn_close);
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalULocaleDataPointer, ULocaleData, ulocdata_close);
|
||||
|
||||
|
|
|
@ -507,7 +507,7 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalUMessageFormatPointer, UMessageFormat, umsg_close);
|
||||
|
||||
|
|
|
@ -266,7 +266,7 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberFormatPointer, UNumberFormat, unum_close);
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalURegularExpressionPointer, URegularExpression, uregex_close);
|
||||
|
||||
|
|
|
@ -304,7 +304,7 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalUStringSearchPointer, UStringSearch, usearch_close);
|
||||
|
||||
|
|
|
@ -309,7 +309,7 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalUSpoofCheckerPointer, USpoofChecker, uspoof_close);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1997-2009, International Business Machines
|
||||
* Copyright (C) 1997-2010, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*******************************************************************************
|
||||
* Date Name Description
|
||||
|
@ -247,7 +247,7 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalUTransliteratorPointer, UTransliterator, utrans_close);
|
||||
|
||||
|
|
|
@ -321,7 +321,7 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @draft ICU 4.4
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalUFILEPointer, UFILE, u_fclose);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue