1 /* 2 ********************************************************************** 3 * Copyright (c) 2002-2012, International Business Machines 4 * Corporation and others. All Rights Reserved. 5 ********************************************************************** 6 * Author: Alan Liu 7 * Created: November 11 2002 8 * Since: ICU 2.4 9 ********************************************************************** 10 */ 11 #ifndef _USTRENUM_H_ 12 #define _USTRENUM_H_ 13 14 #include "unicode/uenum.h" 15 #include "unicode/strenum.h" 16 17 //---------------------------------------------------------------------- 18 U_NAMESPACE_BEGIN 19 20 /** 21 * A wrapper to make a UEnumeration into a StringEnumeration. The 22 * wrapper adopts the UEnumeration is wraps. 23 */ 24 class U_COMMON_API UStringEnumeration : public StringEnumeration { 25 26 public: 27 /** 28 * Constructor. This constructor adopts its UEnumeration 29 * argument. 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 33 * constructor. 34 */ 35 UStringEnumeration(UEnumeration* uenum); 36 37 /** 38 * Destructor. This closes the UEnumeration passed in to the 39 * constructor. 40 */ 41 virtual ~UStringEnumeration(); 42 43 /** 44 * Return the number of elements that the iterator traverses. 45 * @param status the error code. 46 * @return number of elements in the iterator. 47 */ 48 virtual int32_t count(UErrorCode& status) const; 49 50 virtual const char* next(int32_t *resultLength, UErrorCode& status); 51 52 /** 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. 57 */ 58 virtual const UnicodeString* snext(UErrorCode& status); 59 60 /** 61 * Resets the iterator. 62 * @param status the error code. 63 */ 64 virtual void reset(UErrorCode& status); 65 66 /** 67 * ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class. 68 */ 69 virtual UClassID getDynamicClassID() const; 70 71 /** 72 * ICU4C "poor man's RTTI", returns a UClassID for this ICU class. 73 */ 74 static UClassID U_EXPORT2 getStaticClassID(); 75 76 private: 77 UEnumeration *uenum; // owned 78 }; 79 80 U_NAMESPACE_END 81 82 #endif 83 84