OLD | NEW |
(Empty) | |
| 1 /* |
| 2 ********************************************************************** |
| 3 * Copyright (c) 2002-2009, 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 * Given an array of const char* strings (invariant chars only), |
| 19 * return a UEnumeration. Must have strings[i] != 0 for i in |
| 20 * 0..count-1. |
| 21 */ |
| 22 U_CAPI UEnumeration* U_EXPORT2 |
| 23 uenum_openCharStringsEnumeration(const char* const* strings, int32_t count, |
| 24 UErrorCode* ec); |
| 25 |
| 26 //---------------------------------------------------------------------- |
| 27 U_NAMESPACE_BEGIN |
| 28 |
| 29 /** |
| 30 * A wrapper to make a UEnumeration into a StringEnumeration. The |
| 31 * wrapper adopts the UEnumeration is wraps. |
| 32 */ |
| 33 class U_COMMON_API UStringEnumeration : public StringEnumeration { |
| 34 |
| 35 public: |
| 36 /** |
| 37 * Constructor. This constructor adopts its UEnumeration |
| 38 * argument. |
| 39 * @param uenum a UEnumeration object. This object takes |
| 40 * ownership of 'uenum' and will close it in its destructor. The |
| 41 * caller must not call uenum_close on 'uenum' after calling this |
| 42 * constructor. |
| 43 */ |
| 44 UStringEnumeration(UEnumeration* uenum); |
| 45 |
| 46 /** |
| 47 * Destructor. This closes the UEnumeration passed in to the |
| 48 * constructor. |
| 49 */ |
| 50 virtual ~UStringEnumeration(); |
| 51 |
| 52 /** |
| 53 * Return the number of elements that the iterator traverses. |
| 54 * @param status the error code. |
| 55 * @return number of elements in the iterator. |
| 56 */ |
| 57 virtual int32_t count(UErrorCode& status) const; |
| 58 |
| 59 /** |
| 60 * Returns the next element a UnicodeString*. If there are no |
| 61 * more elements, returns NULL. |
| 62 * @param status the error code. |
| 63 * @return a pointer to the string, or NULL. |
| 64 */ |
| 65 virtual const UnicodeString* snext(UErrorCode& status); |
| 66 |
| 67 /** |
| 68 * Resets the iterator. |
| 69 * @param status the error code. |
| 70 */ |
| 71 virtual void reset(UErrorCode& status); |
| 72 |
| 73 /** |
| 74 * ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class. |
| 75 */ |
| 76 virtual UClassID getDynamicClassID() const; |
| 77 |
| 78 /** |
| 79 * ICU4C "poor man's RTTI", returns a UClassID for this ICU class. |
| 80 */ |
| 81 static UClassID U_EXPORT2 getStaticClassID(); |
| 82 |
| 83 private: |
| 84 UEnumeration *uenum; // owned |
| 85 }; |
| 86 |
| 87 U_NAMESPACE_END |
| 88 |
| 89 #endif |
| 90 |
OLD | NEW |