udbgutil.h revision b13da9df870a61b11249bf741347908dbea0edd8
1/* 2************************************************************************ 3* Copyright (c) 2007, International Business Machines 4* Corporation and others. All Rights Reserved. 5************************************************************************ 6*/ 7 8/** C Utilities to aid in debugging **/ 9 10#ifndef _UDBGUTIL_H 11#define _UDBGUTIL_H 12 13#include "unicode/testtype.h" 14#include "unicode/utypes.h" 15 16 17enum UDebugEnumType { 18 UDBG_UDebugEnumType = 0, /* Self-referential, strings for UDebugEnumType. Count=ENUM_COUNT. */ 19 UDBG_UCalendarDateFields, /* UCalendarDateFields. Count=UCAL_FIELD_COUNT. Unsupported if UCONFIG_NO_FORMATTING. */ 20 UDBG_UCalendarMonths, /* UCalendarMonths. Count= (UCAL_UNDECIMBER+1) */ 21 UDBG_UDateFormatStyle, /* Count = UDAT_SHORT=1 */ 22 UDBG_ENUM_COUNT 23}; 24 25typedef enum UDebugEnumType UDebugEnumType; 26 27/** 28 * @param type the type of enum 29 * Print how many enums are contained for this type. 30 * Should be equal to the appropriate _COUNT constant or there is an error. Return -1 if unsupported. 31 */ 32T_CTEST_API int32_t T_CTEST_EXPORT2 udbg_enumCount(UDebugEnumType type); 33 34/** 35 * Convert an enum to a string 36 * @param type type of enum 37 * @param field field number 38 * @return string of the format "ERA", "YEAR", etc, or NULL if out of range or unsupported 39 */ 40T_CTEST_API const char * T_CTEST_EXPORT2 udbg_enumName(UDebugEnumType type, int32_t field); 41 42/** 43 * for consistency checking 44 * @param type the type of enum 45 * Print how many enums should be contained for this type. 46 * This is equal to the appropriate _COUNT constant or there is an error. Returns -1 if unsupported. 47 */ 48T_CTEST_API int32_t T_CTEST_EXPORT2 udbg_enumExpectedCount(UDebugEnumType type); 49 50/** 51 * For consistency checking, returns the expected enum ordinal value for the given index value. 52 * @param type which type 53 * @param field field number 54 * @return should be equal to 'field' or -1 if out of range. 55 */ 56T_CTEST_API int32_t T_CTEST_EXPORT2 udbg_enumArrayValue(UDebugEnumType type, int32_t field); 57 58#endif 59