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