michael@0: /* michael@0: ********************************************************************** michael@0: * Copyright (c) 2002-2012, International Business Machines michael@0: * Corporation and others. All Rights Reserved. michael@0: ********************************************************************** michael@0: * Author: Alan Liu michael@0: * Created: November 11 2002 michael@0: * Since: ICU 2.4 michael@0: ********************************************************************** michael@0: */ michael@0: #ifndef _USTRENUM_H_ michael@0: #define _USTRENUM_H_ michael@0: michael@0: #include "unicode/uenum.h" michael@0: #include "unicode/strenum.h" michael@0: michael@0: //---------------------------------------------------------------------- michael@0: U_NAMESPACE_BEGIN michael@0: michael@0: /** michael@0: * A wrapper to make a UEnumeration into a StringEnumeration. The michael@0: * wrapper adopts the UEnumeration is wraps. michael@0: */ michael@0: class U_COMMON_API UStringEnumeration : public StringEnumeration { michael@0: michael@0: public: michael@0: /** michael@0: * Constructor. This constructor adopts its UEnumeration michael@0: * argument. michael@0: * @param uenum a UEnumeration object. This object takes michael@0: * ownership of 'uenum' and will close it in its destructor. The michael@0: * caller must not call uenum_close on 'uenum' after calling this michael@0: * constructor. michael@0: */ michael@0: UStringEnumeration(UEnumeration* uenum); michael@0: michael@0: /** michael@0: * Destructor. This closes the UEnumeration passed in to the michael@0: * constructor. michael@0: */ michael@0: virtual ~UStringEnumeration(); michael@0: michael@0: /** michael@0: * Return the number of elements that the iterator traverses. michael@0: * @param status the error code. michael@0: * @return number of elements in the iterator. michael@0: */ michael@0: virtual int32_t count(UErrorCode& status) const; michael@0: michael@0: virtual const char* next(int32_t *resultLength, UErrorCode& status); michael@0: michael@0: /** michael@0: * Returns the next element a UnicodeString*. If there are no michael@0: * more elements, returns NULL. michael@0: * @param status the error code. michael@0: * @return a pointer to the string, or NULL. michael@0: */ michael@0: virtual const UnicodeString* snext(UErrorCode& status); michael@0: michael@0: /** michael@0: * Resets the iterator. michael@0: * @param status the error code. michael@0: */ michael@0: virtual void reset(UErrorCode& status); michael@0: michael@0: /** michael@0: * ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class. michael@0: */ michael@0: virtual UClassID getDynamicClassID() const; michael@0: michael@0: /** michael@0: * ICU4C "poor man's RTTI", returns a UClassID for this ICU class. michael@0: */ michael@0: static UClassID U_EXPORT2 getStaticClassID(); michael@0: michael@0: private: michael@0: UEnumeration *uenum; // owned michael@0: }; michael@0: michael@0: U_NAMESPACE_END michael@0: michael@0: #endif michael@0: