sl@0: /* sl@0: ******************************************************************************* sl@0: * sl@0: * Copyright (C) 2002, International Business Machines sl@0: * Corporation and others. All Rights Reserved. sl@0: * sl@0: ******************************************************************************* sl@0: * file name: uenumimp.h sl@0: * encoding: US-ASCII sl@0: * tab size: 8 (not used) sl@0: * indentation:2 sl@0: * sl@0: * created on: 2002jul08 sl@0: * created by: Vladimir Weinstein sl@0: */ sl@0: sl@0: #ifndef __UENUMIMP_H sl@0: #define __UENUMIMP_H sl@0: sl@0: #include "unicode/uenum.h" sl@0: sl@0: U_CDECL_BEGIN sl@0: sl@0: /** sl@0: * following are the type declarations for sl@0: * implementations of APIs. If any of these sl@0: * functions are NULL, U_UNSUPPORTED_ERROR sl@0: * is returned. If close is NULL, the enumeration sl@0: * object is going to be released. sl@0: * Initial error checking is done in the body sl@0: * of API function, so the implementations sl@0: * need not to check the initial error condition. sl@0: */ sl@0: sl@0: /** sl@0: * Function type declaration for uenum_close(). sl@0: * sl@0: * This function should cleanup the enumerator object sl@0: * sl@0: * @param en enumeration to be closed sl@0: */ sl@0: typedef void U_CALLCONV sl@0: UEnumClose(UEnumeration *en); sl@0: sl@0: /** sl@0: * Function type declaration for uenum_count(). sl@0: * sl@0: * This function should count the number of elements sl@0: * in this enumeration sl@0: * sl@0: * @param en enumeration to be counted sl@0: * @param status pointer to UErrorCode variable sl@0: * @return number of elements in enumeration sl@0: */ sl@0: typedef int32_t U_CALLCONV sl@0: UEnumCount(UEnumeration *en, UErrorCode *status); sl@0: sl@0: /** sl@0: * Function type declaration for uenum_unext(). sl@0: * sl@0: * This function should return the next element sl@0: * as a UChar * sl@0: * sl@0: * @param en enumeration sl@0: * @param resultLength pointer to result length sl@0: * @param status pointer to UErrorCode variable sl@0: * @return next element as UChar * sl@0: */ sl@0: typedef const UChar* U_CALLCONV sl@0: UEnumUNext(UEnumeration* en, sl@0: int32_t* resultLength, sl@0: UErrorCode* status); sl@0: sl@0: /** sl@0: * Function type declaration for uenum_next(). sl@0: * sl@0: * This function should return the next element sl@0: * as a char * sl@0: * sl@0: * @param en enumeration sl@0: * @param resultLength pointer to result length sl@0: * @param status pointer to UErrorCode variable sl@0: * @return next element as char * sl@0: */ sl@0: typedef const char* U_CALLCONV sl@0: UEnumNext(UEnumeration* en, sl@0: int32_t* resultLength, sl@0: UErrorCode* status); sl@0: sl@0: /** sl@0: * Function type declaration for uenum_reset(). sl@0: * sl@0: * This function should reset the enumeration sl@0: * object sl@0: * sl@0: * @param en enumeration sl@0: * @param status pointer to UErrorCode variable sl@0: */ sl@0: typedef void U_CALLCONV sl@0: UEnumReset(UEnumeration* en, sl@0: UErrorCode* status); sl@0: sl@0: sl@0: struct UEnumeration { sl@0: /* baseContext. For the base class only. Don't touch! */ sl@0: void *baseContext; sl@0: sl@0: /* context. Use it for what you need */ sl@0: void *context; sl@0: sl@0: /** sl@0: * these are functions that will sl@0: * be used for APIs sl@0: */ sl@0: /* called from uenum_close */ sl@0: UEnumClose *close; sl@0: /* called from uenum_count */ sl@0: UEnumCount *count; sl@0: /* called from uenum_unext */ sl@0: UEnumUNext *uNext; sl@0: /* called from uenum_next */ sl@0: UEnumNext *next; sl@0: /* called from uenum_reset */ sl@0: UEnumReset *reset; sl@0: }; sl@0: sl@0: U_CDECL_END sl@0: sl@0: /* This is the default implementation for uenum_unext(). sl@0: * It automatically converts the char * string to UChar *. sl@0: * Don't call this directly. This is called internally by uenum_unext sl@0: * when a UEnumeration is defined with 'uNext' pointing to this sl@0: * function. sl@0: */ sl@0: U_CAPI const UChar* U_EXPORT2 sl@0: uenum_unextDefault(UEnumeration* en, sl@0: int32_t* resultLength, sl@0: UErrorCode* status); sl@0: sl@0: /* This is the default implementation for uenum_next(). sl@0: * It automatically converts the UChar * string to char *. sl@0: * Don't call this directly. This is called internally by uenum_next sl@0: * when a UEnumeration is defined with 'next' pointing to this sl@0: * function. sl@0: */ sl@0: U_CAPI const char* U_EXPORT2 sl@0: uenum_nextDefault(UEnumeration* en, sl@0: int32_t* resultLength, sl@0: UErrorCode* status); sl@0: sl@0: #endif