2 **********************************************************************
3 * Copyright (c) 2002-2014, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
7 * Created: November 11 2002
9 **********************************************************************
14 #include "unicode/uenum.h"
15 #include "unicode/strenum.h"
17 //----------------------------------------------------------------------
21 * A wrapper to make a UEnumeration into a StringEnumeration. The
22 * wrapper adopts the UEnumeration is wraps.
24 class U_COMMON_API UStringEnumeration
: public StringEnumeration
{
28 * Constructor. This constructor adopts its UEnumeration
30 * @param uenum a UEnumeration object. This object takes
31 * ownership of 'uenum' and will close it in its destructor. The
32 * caller must not call uenum_close on 'uenum' after calling this
35 UStringEnumeration(UEnumeration
* uenum
);
38 * Destructor. This closes the UEnumeration passed in to the
41 virtual ~UStringEnumeration();
44 * Return the number of elements that the iterator traverses.
45 * @param status the error code.
46 * @return number of elements in the iterator.
48 virtual int32_t count(UErrorCode
& status
) const;
50 virtual const char* next(int32_t *resultLength
, UErrorCode
& status
);
53 * Returns the next element a UnicodeString*. If there are no
54 * more elements, returns NULL.
55 * @param status the error code.
56 * @return a pointer to the string, or NULL.
58 virtual const UnicodeString
* snext(UErrorCode
& status
);
61 * Resets the iterator.
62 * @param status the error code.
64 virtual void reset(UErrorCode
& status
);
67 * ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
69 virtual UClassID
getDynamicClassID() const;
72 * ICU4C "poor man's RTTI", returns a UClassID for this ICU class.
74 static UClassID U_EXPORT2
getStaticClassID();
76 static UStringEnumeration
* U_EXPORT2
fromUEnumeration(
77 UEnumeration
*enumToAdopt
, UErrorCode
&status
);
79 UEnumeration
*uenum
; // owned