summaryrefslogtreecommitdiff
path: root/deps/icu-small/source/common/unicode/localpointer.h
diff options
context:
space:
mode:
authorSteven R. Loomis <srloomis@us.ibm.com>2016-10-19 17:24:31 -0700
committerSteven R. Loomis <srloomis@us.ibm.com>2016-10-31 13:42:52 -0700
commit40366df885ec75c7eeee5e7e7626212ae1a6e770 (patch)
tree488aa7a7778b2a42083883540724def7d5eb4f50 /deps/icu-small/source/common/unicode/localpointer.h
parent03023fa7ae060c082a014f792d5d1f481a599460 (diff)
downloadandroid-node-v8-40366df885ec75c7eeee5e7e7626212ae1a6e770.tar.gz
android-node-v8-40366df885ec75c7eeee5e7e7626212ae1a6e770.tar.bz2
android-node-v8-40366df885ec75c7eeee5e7e7626212ae1a6e770.zip
deps: Intl: ICU 58 bump - small icu (BIG COMMIT)
This commit contains the ICU 58.1 delta. It is especially large because of the ICU license change, and, because the line endings were off previously. * bump to ICU 58.1 - check in small ICU source * from 58.1 final http://site.icu-project.org/download/58 Fixes: https://github.com/nodejs/node/issues/7844 PR-URL: https://github.com/nodejs/node/pull/9234 Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'deps/icu-small/source/common/unicode/localpointer.h')
-rw-r--r--deps/icu-small/source/common/unicode/localpointer.h47
1 files changed, 19 insertions, 28 deletions
diff --git a/deps/icu-small/source/common/unicode/localpointer.h b/deps/icu-small/source/common/unicode/localpointer.h
index 35e37765c2..9ac5de5f06 100644
--- a/deps/icu-small/source/common/unicode/localpointer.h
+++ b/deps/icu-small/source/common/unicode/localpointer.h
@@ -1,3 +1,5 @@
+// Copyright (C) 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
*
@@ -211,18 +213,16 @@ public:
errorCode=U_MEMORY_ALLOCATION_ERROR;
}
}
-#ifndef U_HIDE_DRAFT_API
#if U_HAVE_RVALUE_REFERENCES
/**
* Move constructor, leaves src with isNull().
* @param src source smart pointer
- * @draft ICU 56
+ * @stable ICU 56
*/
LocalPointer(LocalPointer<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) {
src.ptr=NULL;
}
#endif
-#endif /* U_HIDE_DRAFT_API */
/**
* Destructor deletes the object it owns.
* @stable ICU 4.4
@@ -230,19 +230,19 @@ public:
~LocalPointer() {
delete LocalPointerBase<T>::ptr;
}
-#ifndef U_HIDE_DRAFT_API
#if U_HAVE_RVALUE_REFERENCES
/**
* Move assignment operator, leaves src with isNull().
* The behavior is undefined if *this and src are the same object.
* @param src source smart pointer
* @return *this
- * @draft ICU 56
+ * @stable ICU 56
*/
LocalPointer<T> &operator=(LocalPointer<T> &&src) U_NOEXCEPT {
return moveFrom(src);
}
#endif
+ // do not use #ifndef U_HIDE_DRAFT_API for moveFrom, needed by non-draft API
/**
* Move assignment, leaves src with isNull().
* The behavior is undefined if *this and src are the same object.
@@ -261,19 +261,18 @@ public:
/**
* Swap pointers.
* @param other other smart pointer
- * @draft ICU 56
+ * @stable ICU 56
*/
void swap(LocalPointer<T> &other) U_NOEXCEPT {
T *temp=LocalPointerBase<T>::ptr;
LocalPointerBase<T>::ptr=other.ptr;
other.ptr=temp;
}
-#endif /* U_HIDE_DRAFT_API */
/**
* Non-member LocalPointer swap function.
* @param p1 will get p2's pointer
* @param p2 will get p1's pointer
- * @draft ICU 56
+ * @stable ICU 56
*/
friend inline void swap(LocalPointer<T> &p1, LocalPointer<T> &p2) U_NOEXCEPT {
p1.swap(p2);
@@ -345,7 +344,6 @@ public:
* @stable ICU 4.4
*/
explicit LocalArray(T *p=NULL) : LocalPointerBase<T>(p) {}
-#ifndef U_HIDE_DRAFT_API
/**
* Constructor takes ownership and reports an error if NULL.
*
@@ -357,7 +355,7 @@ public:
* @param p simple pointer to an array of T objects that is adopted
* @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR
* if p==NULL and no other failure code had been set
- * @draft ICU 56
+ * @stable ICU 56
*/
LocalArray(T *p, UErrorCode &errorCode) : LocalPointerBase<T>(p) {
if(p==NULL && U_SUCCESS(errorCode)) {
@@ -368,13 +366,12 @@ public:
/**
* Move constructor, leaves src with isNull().
* @param src source smart pointer
- * @draft ICU 56
+ * @stable ICU 56
*/
LocalArray(LocalArray<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) {
src.ptr=NULL;
}
#endif
-#endif /* U_HIDE_DRAFT_API */
/**
* Destructor deletes the array it owns.
* @stable ICU 4.4
@@ -382,19 +379,19 @@ public:
~LocalArray() {
delete[] LocalPointerBase<T>::ptr;
}
-#ifndef U_HIDE_DRAFT_API
#if U_HAVE_RVALUE_REFERENCES
/**
* Move assignment operator, leaves src with isNull().
* The behavior is undefined if *this and src are the same object.
* @param src source smart pointer
* @return *this
- * @draft ICU 56
+ * @stable ICU 56
*/
LocalArray<T> &operator=(LocalArray<T> &&src) U_NOEXCEPT {
return moveFrom(src);
}
#endif
+ // do not use #ifndef U_HIDE_DRAFT_API for moveFrom, needed by non-draft API
/**
* Move assignment, leaves src with isNull().
* The behavior is undefined if *this and src are the same object.
@@ -413,19 +410,18 @@ public:
/**
* Swap pointers.
* @param other other smart pointer
- * @draft ICU 56
+ * @stable ICU 56
*/
void swap(LocalArray<T> &other) U_NOEXCEPT {
T *temp=LocalPointerBase<T>::ptr;
LocalPointerBase<T>::ptr=other.ptr;
other.ptr=temp;
}
-#endif /* U_HIDE_DRAFT_API */
/**
* Non-member LocalArray swap function.
* @param p1 will get p2's pointer
* @param p2 will get p1's pointer
- * @draft ICU 56
+ * @stable ICU 56
*/
friend inline void swap(LocalArray<T> &p1, LocalArray<T> &p2) U_NOEXCEPT {
p1.swap(p2);
@@ -440,7 +436,6 @@ public:
delete[] LocalPointerBase<T>::ptr;
LocalPointerBase<T>::ptr=p;
}
-#ifndef U_HIDE_DRAFT_API
/**
* Deletes the array it owns,
* and adopts (takes ownership of) the one passed in.
@@ -454,7 +449,7 @@ public:
* @param p simple pointer to an array of T objects that is adopted
* @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR
* if p==NULL and no other failure code had been set
- * @draft ICU 56
+ * @stable ICU 56
*/
void adoptInsteadAndCheckErrorCode(T *p, UErrorCode &errorCode) {
if(U_SUCCESS(errorCode)) {
@@ -467,7 +462,6 @@ public:
delete[] p;
}
}
-#endif /* U_HIDE_DRAFT_API */
/**
* Array item access (writable).
* No index bounds check.
@@ -485,9 +479,6 @@ public:
* like LocalPointer<Type> except that this subclass will use the closeFunction
* rather than the C++ delete operator.
*
- * Requirement: The closeFunction must tolerate a NULL pointer.
- * (We could add a NULL check here but it is normally redundant.)
- *
* Usage example:
* \code
* LocalUCaseMapPointer csm(ucasemap_open(localeID, options, &errorCode));
@@ -512,12 +503,12 @@ public:
: LocalPointerBase<Type>(src.ptr) { \
src.ptr=NULL; \
} \
- ~LocalPointerClassName() { closeFunction(ptr); } \
+ ~LocalPointerClassName() { if (ptr != NULL) { closeFunction(ptr); } } \
LocalPointerClassName &operator=(LocalPointerClassName &&src) U_NOEXCEPT { \
return moveFrom(src); \
} \
LocalPointerClassName &moveFrom(LocalPointerClassName &src) U_NOEXCEPT { \
- closeFunction(ptr); \
+ if (ptr != NULL) { closeFunction(ptr); } \
LocalPointerBase<Type>::ptr=src.ptr; \
src.ptr=NULL; \
return *this; \
@@ -531,7 +522,7 @@ public:
p1.swap(p2); \
} \
void adoptInstead(Type *p) { \
- closeFunction(ptr); \
+ if (ptr != NULL) { closeFunction(ptr); } \
ptr=p; \
} \
}
@@ -544,7 +535,7 @@ public:
explicit LocalPointerClassName(Type *p=NULL) : LocalPointerBase<Type>(p) {} \
~LocalPointerClassName() { closeFunction(ptr); } \
LocalPointerClassName &moveFrom(LocalPointerClassName &src) U_NOEXCEPT { \
- closeFunction(ptr); \
+ if (ptr != NULL) { closeFunction(ptr); } \
LocalPointerBase<Type>::ptr=src.ptr; \
src.ptr=NULL; \
return *this; \
@@ -558,7 +549,7 @@ public:
p1.swap(p2); \
} \
void adoptInstead(Type *p) { \
- closeFunction(ptr); \
+ if (ptr != NULL) { closeFunction(ptr); } \
ptr=p; \
} \
}