X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/51004dcb01e06fef634b61be77ed73dd61cb6db9..cecc3f9394f261e71def48cf396d137687dbd0a7:/icuSources/common/ustrenum.cpp?ds=sidebyside diff --git a/icuSources/common/ustrenum.cpp b/icuSources/common/ustrenum.cpp index dd7fe78a..ed23eaa2 100644 --- a/icuSources/common/ustrenum.cpp +++ b/icuSources/common/ustrenum.cpp @@ -1,6 +1,8 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** -* Copyright (c) 2002-2012, International Business Machines +* Copyright (c) 2002-2014, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * Author: Alan Liu @@ -130,6 +132,22 @@ StringEnumeration::operator!=(const StringEnumeration& that)const { // UStringEnumeration implementation --------------------------------------- *** +UStringEnumeration * U_EXPORT2 +UStringEnumeration::fromUEnumeration( + UEnumeration *uenumToAdopt, UErrorCode &status) { + if (U_FAILURE(status)) { + uenum_close(uenumToAdopt); + return NULL; + } + UStringEnumeration *result = new UStringEnumeration(uenumToAdopt); + if (result == NULL) { + status = U_MEMORY_ALLOCATION_ERROR; + uenum_close(uenumToAdopt); + return NULL; + } + return result; +} + UStringEnumeration::UStringEnumeration(UEnumeration* _uenum) : uenum(_uenum) { U_ASSERT(_uenum != 0);