2 **********************************************************************
3 * Copyright (c) 2002-2004, 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"
18 * Given a StringEnumeration, wrap it in a UEnumeration. The
19 * StringEnumeration is adopted; after this call, the caller must not
20 * delete it (regardless of error status).
22 U_CAPI UEnumeration
* U_EXPORT2
23 uenum_openStringEnumeration(StringEnumeration
* adopted
, UErrorCode
* ec
);
26 * Given an array of const char* strings (invariant chars only),
27 * return a UEnumeration. Must have strings[i] != 0 for i in
30 U_CAPI UEnumeration
* U_EXPORT2
31 uenum_openCharStringsEnumeration(const char** strings
, int32_t count
,
34 //----------------------------------------------------------------------
38 * A wrapper to make a UEnumeration into a StringEnumeration. The
39 * wrapper adopts the UEnumeration is wraps.
41 class U_COMMON_API UStringEnumeration
: public StringEnumeration
{
45 * Constructor. This constructor adopts its UEnumeration
47 * @param uenum a UEnumeration object. This object takes
48 * ownership of 'uenum' and will close it in its destructor. The
49 * caller must not call uenum_close on 'uenum' after calling this
52 UStringEnumeration(UEnumeration
* uenum
);
55 * Destructor. This closes the UEnumeration passed in to the
58 virtual ~UStringEnumeration();
61 * Return the number of elements that the iterator traverses.
62 * @param status the error code.
63 * @return number of elements in the iterator.
65 virtual int32_t count(UErrorCode
& status
) const;
68 * Returns the next element a UnicodeString*. If there are no
69 * more elements, returns NULL.
70 * @param status the error code.
71 * @return a pointer to the string, or NULL.
73 virtual const UnicodeString
* snext(UErrorCode
& status
);
76 * Resets the iterator.
77 * @param status the error code.
79 virtual void reset(UErrorCode
& status
);
82 * ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
84 virtual UClassID
getDynamicClassID() const;
87 * ICU4C "poor man's RTTI", returns a UClassID for this ICU class.
89 static UClassID U_EXPORT2
getStaticClassID();
92 UEnumeration
*uenum
; // owned