]> git.saurik.com Git - apple/icu.git/blame - icuSources/common/uenumimp.h
ICU-57163.0.1.tar.gz
[apple/icu.git] / icuSources / common / uenumimp.h
CommitLineData
b75a7d8f
A
1/*
2*******************************************************************************
3*
73c04bcf 4* Copyright (C) 2002-2006, International Business Machines
b75a7d8f
A
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
22U_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 */
42typedef void U_CALLCONV
43UEnumClose(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 */
55typedef int32_t U_CALLCONV
56UEnumCount(UEnumeration *en, UErrorCode *status);
57
58/**
59 * Function type declaration for uenum_unext().
60 *
73c04bcf
A
61 * This function returns the next element as a UChar *,
62 * or NULL after all elements haven been enumerated.
b75a7d8f
A
63 *
64 * @param en enumeration
65 * @param resultLength pointer to result length
66 * @param status pointer to UErrorCode variable
73c04bcf
A
67 * @return next element as UChar *,
68 * or NULL after all elements haven been enumerated
b75a7d8f
A
69 */
70typedef const UChar* U_CALLCONV
71UEnumUNext(UEnumeration* en,
72 int32_t* resultLength,
73 UErrorCode* status);
74
75/**
76 * Function type declaration for uenum_next().
77 *
73c04bcf
A
78 * This function returns the next element as a char *,
79 * or NULL after all elements haven been enumerated.
b75a7d8f
A
80 *
81 * @param en enumeration
82 * @param resultLength pointer to result length
83 * @param status pointer to UErrorCode variable
73c04bcf
A
84 * @return next element as char *,
85 * or NULL after all elements haven been enumerated
b75a7d8f
A
86 */
87typedef const char* U_CALLCONV
88UEnumNext(UEnumeration* en,
89 int32_t* resultLength,
90 UErrorCode* status);
91
92/**
93 * Function type declaration for uenum_reset().
94 *
95 * This function should reset the enumeration
96 * object
97 *
98 * @param en enumeration
99 * @param status pointer to UErrorCode variable
100 */
101typedef void U_CALLCONV
102UEnumReset(UEnumeration* en,
103 UErrorCode* status);
104
105
106struct UEnumeration {
107 /* baseContext. For the base class only. Don't touch! */
108 void *baseContext;
109
110 /* context. Use it for what you need */
111 void *context;
112
113 /**
114 * these are functions that will
115 * be used for APIs
116 */
117 /* called from uenum_close */
118 UEnumClose *close;
119 /* called from uenum_count */
120 UEnumCount *count;
121 /* called from uenum_unext */
122 UEnumUNext *uNext;
123 /* called from uenum_next */
124 UEnumNext *next;
125 /* called from uenum_reset */
126 UEnumReset *reset;
127};
128
129U_CDECL_END
130
131/* This is the default implementation for uenum_unext().
132 * It automatically converts the char * string to UChar *.
133 * Don't call this directly. This is called internally by uenum_unext
134 * when a UEnumeration is defined with 'uNext' pointing to this
135 * function.
136 */
137U_CAPI const UChar* U_EXPORT2
138uenum_unextDefault(UEnumeration* en,
139 int32_t* resultLength,
140 UErrorCode* status);
141
142/* This is the default implementation for uenum_next().
143 * It automatically converts the UChar * string to char *.
144 * Don't call this directly. This is called internally by uenum_next
145 * when a UEnumeration is defined with 'next' pointing to this
146 * function.
147 */
148U_CAPI const char* U_EXPORT2
149uenum_nextDefault(UEnumeration* en,
150 int32_t* resultLength,
151 UErrorCode* status);
152
153#endif