1 /* 2 ********************************************************************** 3 * Copyright (C) 1999-2006, International Business Machines 4 * Corporation and others. All Rights Reserved. 5 ********************************************************************** 6 * 7 * 8 * ucnv_imp.h: 9 * Contains all internal and external data structure definitions 10 * Created & Maitained by Bertrand A. Damiba 11 * 12 * 13 * 14 * ATTENTION: 15 * --------- 16 * Although the data structures in this file are open and stack allocatable 17 * we reserve the right to hide them in further releases. 18 */ 19 20 #ifndef UCNV_IMP_H 21 #define UCNV_IMP_H 22 23 #include "unicode/utypes.h" 24 25 #if !UCONFIG_NO_CONVERSION 26 27 #include "unicode/uloc.h" 28 #include "ucnv_bld.h" 29 30 /* figures out if we need to go to file to read in the data tables. 31 * @param converterName The name of the converter 32 * @param err The error code 33 * @return the newly created converter 34 */ 35 UConverter *ucnv_createConverter (UConverter *myUConverter, const char *converterName, UErrorCode * err); 36 37 /* 38 * Open a purely algorithmic converter, specified by a type constant. 39 * @param myUConverter NULL, or pre-allocated UConverter structure to avoid 40 * a memory allocation 41 * @param type requested converter type 42 * @param locale locale parameter, or "" 43 * @param options converter options bit set (default 0) 44 * @param err ICU error code, not tested for U_FAILURE on input 45 * because this is an internal function 46 * @internal 47 */ 48 U_CFUNC UConverter * 49 ucnv_createAlgorithmicConverter(UConverter *myUConverter, 50 UConverterType type, 51 const char *locale, uint32_t options, 52 UErrorCode *err); 53 54 /* Creates a converter from shared data 55 */ 56 UConverter* 57 ucnv_createConverterFromSharedData(UConverter *myUConverter, UConverterSharedData *mySharedConverterData, const char *realName, const char *locale, uint32_t options, UErrorCode *err); 58 59 UConverter* ucnv_createConverterFromPackage(const char *packageName, const char *converterName, 60 UErrorCode *err); 61 62 typedef struct { 63 char cnvName[UCNV_MAX_CONVERTER_NAME_LENGTH], locale[ULOC_FULLNAME_CAPACITY]; 64 const char *realName; 65 uint32_t options; 66 } UConverterLookupData; 67 68 /** 69 * Load a converter but do not create a UConverter object. 70 * Simply return the UConverterSharedData. 71 * Performs alias lookup etc. 72 * @internal 73 */ 74 UConverterSharedData * 75 ucnv_loadSharedData(const char *converterName, UConverterLookupData *lookup, UErrorCode * err); 76 77 /** 78 * This may unload the shared data in a thread safe manner. 79 * This will only unload the data if no other converters are sharing it. 80 */ 81 void 82 ucnv_unloadSharedDataIfReady(UConverterSharedData *sharedData); 83 84 /** 85 * This is a thread safe way to increment the reference count. 86 */ 87 void 88 ucnv_incrementRefCount(UConverterSharedData *sharedData); 89 90 #define UCNV_TO_U_DEFAULT_CALLBACK ((UConverterToUCallback) UCNV_TO_U_CALLBACK_SUBSTITUTE) 91 #define UCNV_FROM_U_DEFAULT_CALLBACK ((UConverterFromUCallback) UCNV_FROM_U_CALLBACK_SUBSTITUTE) 92 93 #endif 94 95 #endif /* _UCNV_IMP */ 96