]> git.saurik.com Git - apple/icu.git/blame - icuSources/common/ustrenum.h
ICU-59180.0.1.tar.gz
[apple/icu.git] / icuSources / common / ustrenum.h
CommitLineData
f3c0d7a5
A
1// © 2016 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html
b75a7d8f
A
3/*
4**********************************************************************
b331163b 5* Copyright (c) 2002-2014, International Business Machines
b75a7d8f
A
6* Corporation and others. All Rights Reserved.
7**********************************************************************
8* Author: Alan Liu
9* Created: November 11 2002
10* Since: ICU 2.4
11**********************************************************************
12*/
13#ifndef _USTRENUM_H_
14#define _USTRENUM_H_
15
16#include "unicode/uenum.h"
17#include "unicode/strenum.h"
18
374ca955
A
19//----------------------------------------------------------------------
20U_NAMESPACE_BEGIN
21
22/**
23 * A wrapper to make a UEnumeration into a StringEnumeration. The
24 * wrapper adopts the UEnumeration is wraps.
25 */
26class U_COMMON_API UStringEnumeration : public StringEnumeration {
27
28public:
29 /**
30 * Constructor. This constructor adopts its UEnumeration
31 * argument.
32 * @param uenum a UEnumeration object. This object takes
33 * ownership of 'uenum' and will close it in its destructor. The
34 * caller must not call uenum_close on 'uenum' after calling this
35 * constructor.
36 */
37 UStringEnumeration(UEnumeration* uenum);
38
39 /**
40 * Destructor. This closes the UEnumeration passed in to the
41 * constructor.
42 */
43 virtual ~UStringEnumeration();
44
45 /**
46 * Return the number of elements that the iterator traverses.
47 * @param status the error code.
48 * @return number of elements in the iterator.
49 */
50 virtual int32_t count(UErrorCode& status) const;
51
51004dcb
A
52 virtual const char* next(int32_t *resultLength, UErrorCode& status);
53
374ca955
A
54 /**
55 * Returns the next element a UnicodeString*. If there are no
56 * more elements, returns NULL.
57 * @param status the error code.
58 * @return a pointer to the string, or NULL.
59 */
60 virtual const UnicodeString* snext(UErrorCode& status);
61
62 /**
63 * Resets the iterator.
64 * @param status the error code.
65 */
66 virtual void reset(UErrorCode& status);
67
68 /**
69 * ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
70 */
71 virtual UClassID getDynamicClassID() const;
72
73 /**
74 * ICU4C "poor man's RTTI", returns a UClassID for this ICU class.
75 */
76 static UClassID U_EXPORT2 getStaticClassID();
77
b331163b
A
78 static UStringEnumeration * U_EXPORT2 fromUEnumeration(
79 UEnumeration *enumToAdopt, UErrorCode &status);
374ca955
A
80private:
81 UEnumeration *uenum; // owned
82};
83
84U_NAMESPACE_END
85
b75a7d8f 86#endif
374ca955 87