1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/icu/source/common/ustrenum.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,83 @@ 1.4 +/* 1.5 +********************************************************************** 1.6 +* Copyright (c) 2002-2012, International Business Machines 1.7 +* Corporation and others. All Rights Reserved. 1.8 +********************************************************************** 1.9 +* Author: Alan Liu 1.10 +* Created: November 11 2002 1.11 +* Since: ICU 2.4 1.12 +********************************************************************** 1.13 +*/ 1.14 +#ifndef _USTRENUM_H_ 1.15 +#define _USTRENUM_H_ 1.16 + 1.17 +#include "unicode/uenum.h" 1.18 +#include "unicode/strenum.h" 1.19 + 1.20 +//---------------------------------------------------------------------- 1.21 +U_NAMESPACE_BEGIN 1.22 + 1.23 +/** 1.24 + * A wrapper to make a UEnumeration into a StringEnumeration. The 1.25 + * wrapper adopts the UEnumeration is wraps. 1.26 + */ 1.27 +class U_COMMON_API UStringEnumeration : public StringEnumeration { 1.28 + 1.29 +public: 1.30 + /** 1.31 + * Constructor. This constructor adopts its UEnumeration 1.32 + * argument. 1.33 + * @param uenum a UEnumeration object. This object takes 1.34 + * ownership of 'uenum' and will close it in its destructor. The 1.35 + * caller must not call uenum_close on 'uenum' after calling this 1.36 + * constructor. 1.37 + */ 1.38 + UStringEnumeration(UEnumeration* uenum); 1.39 + 1.40 + /** 1.41 + * Destructor. This closes the UEnumeration passed in to the 1.42 + * constructor. 1.43 + */ 1.44 + virtual ~UStringEnumeration(); 1.45 + 1.46 + /** 1.47 + * Return the number of elements that the iterator traverses. 1.48 + * @param status the error code. 1.49 + * @return number of elements in the iterator. 1.50 + */ 1.51 + virtual int32_t count(UErrorCode& status) const; 1.52 + 1.53 + virtual const char* next(int32_t *resultLength, UErrorCode& status); 1.54 + 1.55 + /** 1.56 + * Returns the next element a UnicodeString*. If there are no 1.57 + * more elements, returns NULL. 1.58 + * @param status the error code. 1.59 + * @return a pointer to the string, or NULL. 1.60 + */ 1.61 + virtual const UnicodeString* snext(UErrorCode& status); 1.62 + 1.63 + /** 1.64 + * Resets the iterator. 1.65 + * @param status the error code. 1.66 + */ 1.67 + virtual void reset(UErrorCode& status); 1.68 + 1.69 + /** 1.70 + * ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class. 1.71 + */ 1.72 + virtual UClassID getDynamicClassID() const; 1.73 + 1.74 + /** 1.75 + * ICU4C "poor man's RTTI", returns a UClassID for this ICU class. 1.76 + */ 1.77 + static UClassID U_EXPORT2 getStaticClassID(); 1.78 + 1.79 +private: 1.80 + UEnumeration *uenum; // owned 1.81 +}; 1.82 + 1.83 +U_NAMESPACE_END 1.84 + 1.85 +#endif 1.86 +