1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 **********************************************************************
5 * Copyright (c) 2002-2014, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 **********************************************************************
9 * Created: November 11 2002
11 **********************************************************************
16 #include "unicode/uenum.h"
17 #include "unicode/strenum.h"
19 //----------------------------------------------------------------------
23 * A wrapper to make a UEnumeration into a StringEnumeration. The
24 * wrapper adopts the UEnumeration is wraps.
26 class U_COMMON_API UStringEnumeration
: public StringEnumeration
{
30 * Constructor. This constructor adopts its UEnumeration
32 * @param uenum a UEnumeration object. This object takes
33 * ownership of 'uenum' and will close it in its destructor. The
34 * caller must not call uenum_close on 'uenum' after calling this
37 UStringEnumeration(UEnumeration
* uenum
);
40 * Destructor. This closes the UEnumeration passed in to the
43 virtual ~UStringEnumeration();
46 * Return the number of elements that the iterator traverses.
47 * @param status the error code.
48 * @return number of elements in the iterator.
50 virtual int32_t count(UErrorCode
& status
) const;
52 virtual const char* next(int32_t *resultLength
, UErrorCode
& status
);
55 * Returns the next element a UnicodeString*. If there are no
56 * more elements, returns NULL.
57 * @param status the error code.
58 * @return a pointer to the string, or NULL.
60 virtual const UnicodeString
* snext(UErrorCode
& status
);
63 * Resets the iterator.
64 * @param status the error code.
66 virtual void reset(UErrorCode
& status
);
69 * ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
71 virtual UClassID
getDynamicClassID() const;
74 * ICU4C "poor man's RTTI", returns a UClassID for this ICU class.
76 static UClassID U_EXPORT2
getStaticClassID();
78 static UStringEnumeration
* U_EXPORT2
fromUEnumeration(
79 UEnumeration
*enumToAdopt
, UErrorCode
&status
);
81 UEnumeration
*uenum
; // owned