]> git.saurik.com Git - apple/icu.git/blob - icuSources/common/uenumimp.h
ICU-3.13.tar.gz
[apple/icu.git] / icuSources / common / uenumimp.h
1 /*
2 *******************************************************************************
3 *
4 * Copyright (C) 2002, International Business Machines
5 * Corporation and others. All Rights Reserved.
6 *
7 *******************************************************************************
8 * file name: uenumimp.h
9 * encoding: US-ASCII
10 * tab size: 8 (not used)
11 * indentation:2
12 *
13 * created on: 2002jul08
14 * created by: Vladimir Weinstein
15 */
16
17 #ifndef __UENUMIMP_H
18 #define __UENUMIMP_H
19
20 #include "unicode/uenum.h"
21
22 U_CDECL_BEGIN
23
24 /**
25 * following are the type declarations for
26 * implementations of APIs. If any of these
27 * functions are NULL, U_UNSUPPORTED_ERROR
28 * is returned. If close is NULL, the enumeration
29 * object is going to be released.
30 * Initial error checking is done in the body
31 * of API function, so the implementations
32 * need not to check the initial error condition.
33 */
34
35 /**
36 * Function type declaration for uenum_close().
37 *
38 * This function should cleanup the enumerator object
39 *
40 * @param en enumeration to be closed
41 */
42 typedef void U_CALLCONV
43 UEnumClose(UEnumeration *en);
44
45 /**
46 * Function type declaration for uenum_count().
47 *
48 * This function should count the number of elements
49 * in this enumeration
50 *
51 * @param en enumeration to be counted
52 * @param status pointer to UErrorCode variable
53 * @return number of elements in enumeration
54 */
55 typedef int32_t U_CALLCONV
56 UEnumCount(UEnumeration *en, UErrorCode *status);
57
58 /**
59 * Function type declaration for uenum_unext().
60 *
61 * This function should return the next element
62 * as a UChar *
63 *
64 * @param en enumeration
65 * @param resultLength pointer to result length
66 * @param status pointer to UErrorCode variable
67 * @return next element as UChar *
68 */
69 typedef const UChar* U_CALLCONV
70 UEnumUNext(UEnumeration* en,
71 int32_t* resultLength,
72 UErrorCode* status);
73
74 /**
75 * Function type declaration for uenum_next().
76 *
77 * This function should return the next element
78 * as a char *
79 *
80 * @param en enumeration
81 * @param resultLength pointer to result length
82 * @param status pointer to UErrorCode variable
83 * @return next element as char *
84 */
85 typedef const char* U_CALLCONV
86 UEnumNext(UEnumeration* en,
87 int32_t* resultLength,
88 UErrorCode* status);
89
90 /**
91 * Function type declaration for uenum_reset().
92 *
93 * This function should reset the enumeration
94 * object
95 *
96 * @param en enumeration
97 * @param status pointer to UErrorCode variable
98 */
99 typedef void U_CALLCONV
100 UEnumReset(UEnumeration* en,
101 UErrorCode* status);
102
103
104 struct UEnumeration {
105 /* baseContext. For the base class only. Don't touch! */
106 void *baseContext;
107
108 /* context. Use it for what you need */
109 void *context;
110
111 /**
112 * these are functions that will
113 * be used for APIs
114 */
115 /* called from uenum_close */
116 UEnumClose *close;
117 /* called from uenum_count */
118 UEnumCount *count;
119 /* called from uenum_unext */
120 UEnumUNext *uNext;
121 /* called from uenum_next */
122 UEnumNext *next;
123 /* called from uenum_reset */
124 UEnumReset *reset;
125 };
126
127 U_CDECL_END
128
129 /* This is the default implementation for uenum_unext().
130 * It automatically converts the char * string to UChar *.
131 * Don't call this directly. This is called internally by uenum_unext
132 * when a UEnumeration is defined with 'uNext' pointing to this
133 * function.
134 */
135 U_CAPI const UChar* U_EXPORT2
136 uenum_unextDefault(UEnumeration* en,
137 int32_t* resultLength,
138 UErrorCode* status);
139
140 /* This is the default implementation for uenum_next().
141 * It automatically converts the UChar * string to char *.
142 * Don't call this directly. This is called internally by uenum_next
143 * when a UEnumeration is defined with 'next' pointing to this
144 * function.
145 */
146 U_CAPI const char* U_EXPORT2
147 uenum_nextDefault(UEnumeration* en,
148 int32_t* resultLength,
149 UErrorCode* status);
150
151 #endif