1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/icu/source/common/uenumimp.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,153 @@ 1.4 +/* 1.5 +******************************************************************************* 1.6 +* 1.7 +* Copyright (C) 2002-2006, International Business Machines 1.8 +* Corporation and others. All Rights Reserved. 1.9 +* 1.10 +******************************************************************************* 1.11 +* file name: uenumimp.h 1.12 +* encoding: US-ASCII 1.13 +* tab size: 8 (not used) 1.14 +* indentation:2 1.15 +* 1.16 +* created on: 2002jul08 1.17 +* created by: Vladimir Weinstein 1.18 +*/ 1.19 + 1.20 +#ifndef __UENUMIMP_H 1.21 +#define __UENUMIMP_H 1.22 + 1.23 +#include "unicode/uenum.h" 1.24 + 1.25 +U_CDECL_BEGIN 1.26 + 1.27 +/** 1.28 + * following are the type declarations for 1.29 + * implementations of APIs. If any of these 1.30 + * functions are NULL, U_UNSUPPORTED_ERROR 1.31 + * is returned. If close is NULL, the enumeration 1.32 + * object is going to be released. 1.33 + * Initial error checking is done in the body 1.34 + * of API function, so the implementations 1.35 + * need not to check the initial error condition. 1.36 + */ 1.37 + 1.38 +/** 1.39 + * Function type declaration for uenum_close(). 1.40 + * 1.41 + * This function should cleanup the enumerator object 1.42 + * 1.43 + * @param en enumeration to be closed 1.44 + */ 1.45 +typedef void U_CALLCONV 1.46 +UEnumClose(UEnumeration *en); 1.47 + 1.48 +/** 1.49 + * Function type declaration for uenum_count(). 1.50 + * 1.51 + * This function should count the number of elements 1.52 + * in this enumeration 1.53 + * 1.54 + * @param en enumeration to be counted 1.55 + * @param status pointer to UErrorCode variable 1.56 + * @return number of elements in enumeration 1.57 + */ 1.58 +typedef int32_t U_CALLCONV 1.59 +UEnumCount(UEnumeration *en, UErrorCode *status); 1.60 + 1.61 +/** 1.62 + * Function type declaration for uenum_unext(). 1.63 + * 1.64 + * This function returns the next element as a UChar *, 1.65 + * or NULL after all elements haven been enumerated. 1.66 + * 1.67 + * @param en enumeration 1.68 + * @param resultLength pointer to result length 1.69 + * @param status pointer to UErrorCode variable 1.70 + * @return next element as UChar *, 1.71 + * or NULL after all elements haven been enumerated 1.72 + */ 1.73 +typedef const UChar* U_CALLCONV 1.74 +UEnumUNext(UEnumeration* en, 1.75 + int32_t* resultLength, 1.76 + UErrorCode* status); 1.77 + 1.78 +/** 1.79 + * Function type declaration for uenum_next(). 1.80 + * 1.81 + * This function returns the next element as a char *, 1.82 + * or NULL after all elements haven been enumerated. 1.83 + * 1.84 + * @param en enumeration 1.85 + * @param resultLength pointer to result length 1.86 + * @param status pointer to UErrorCode variable 1.87 + * @return next element as char *, 1.88 + * or NULL after all elements haven been enumerated 1.89 + */ 1.90 +typedef const char* U_CALLCONV 1.91 +UEnumNext(UEnumeration* en, 1.92 + int32_t* resultLength, 1.93 + UErrorCode* status); 1.94 + 1.95 +/** 1.96 + * Function type declaration for uenum_reset(). 1.97 + * 1.98 + * This function should reset the enumeration 1.99 + * object 1.100 + * 1.101 + * @param en enumeration 1.102 + * @param status pointer to UErrorCode variable 1.103 + */ 1.104 +typedef void U_CALLCONV 1.105 +UEnumReset(UEnumeration* en, 1.106 + UErrorCode* status); 1.107 + 1.108 + 1.109 +struct UEnumeration { 1.110 + /* baseContext. For the base class only. Don't touch! */ 1.111 + void *baseContext; 1.112 + 1.113 + /* context. Use it for what you need */ 1.114 + void *context; 1.115 + 1.116 + /** 1.117 + * these are functions that will 1.118 + * be used for APIs 1.119 + */ 1.120 + /* called from uenum_close */ 1.121 + UEnumClose *close; 1.122 + /* called from uenum_count */ 1.123 + UEnumCount *count; 1.124 + /* called from uenum_unext */ 1.125 + UEnumUNext *uNext; 1.126 + /* called from uenum_next */ 1.127 + UEnumNext *next; 1.128 + /* called from uenum_reset */ 1.129 + UEnumReset *reset; 1.130 +}; 1.131 + 1.132 +U_CDECL_END 1.133 + 1.134 +/* This is the default implementation for uenum_unext(). 1.135 + * It automatically converts the char * string to UChar *. 1.136 + * Don't call this directly. This is called internally by uenum_unext 1.137 + * when a UEnumeration is defined with 'uNext' pointing to this 1.138 + * function. 1.139 + */ 1.140 +U_CAPI const UChar* U_EXPORT2 1.141 +uenum_unextDefault(UEnumeration* en, 1.142 + int32_t* resultLength, 1.143 + UErrorCode* status); 1.144 + 1.145 +/* This is the default implementation for uenum_next(). 1.146 + * It automatically converts the UChar * string to char *. 1.147 + * Don't call this directly. This is called internally by uenum_next 1.148 + * when a UEnumeration is defined with 'next' pointing to this 1.149 + * function. 1.150 + */ 1.151 +U_CAPI const char* U_EXPORT2 1.152 +uenum_nextDefault(UEnumeration* en, 1.153 + int32_t* resultLength, 1.154 + UErrorCode* status); 1.155 + 1.156 +#endif