1 // © 2016 and later: Unicode, Inc. and others. 2 // License & terms of use: http://www.unicode.org/copyright.html 3 /* 4 ********************************************************************** 5 * Copyright (C) 1999-2006, International Business Machines 6 * Corporation and others. All Rights Reserved. 7 ********************************************************************** 8 * 9 * 10 * ucnv_io.h: 11 * defines variables and functions pertaining to converter name resolution 12 * aspect of the conversion code 13 */ 14 15 #ifndef UCNV_IO_H 16 #define UCNV_IO_H 17 18 #include "unicode/utypes.h" 19 20 #if !UCONFIG_NO_CONVERSION 21 22 #include "udataswp.h" 23 24 #define UCNV_AMBIGUOUS_ALIAS_MAP_BIT 0x8000 25 #define UCNV_CONTAINS_OPTION_BIT 0x4000 26 #define UCNV_CONVERTER_INDEX_MASK 0xFFF 27 #define UCNV_NUM_RESERVED_TAGS 2 28 #define UCNV_NUM_HIDDEN_TAGS 1 29 30 enum { 31 UCNV_IO_UNNORMALIZED, 32 UCNV_IO_STD_NORMALIZED, 33 UCNV_IO_NORM_TYPE_COUNT 34 }; 35 36 typedef struct { 37 uint16_t stringNormalizationType; 38 uint16_t containsCnvOptionInfo; 39 } UConverterAliasOptions; 40 41 typedef struct UConverterAlias { 42 const uint16_t *converterList; 43 const uint16_t *tagList; 44 const uint16_t *aliasList; 45 const uint16_t *untaggedConvArray; 46 const uint16_t *taggedAliasArray; 47 const uint16_t *taggedAliasLists; 48 const UConverterAliasOptions *optionTable; 49 const uint16_t *stringTable; 50 const uint16_t *normalizedStringTable; 51 52 uint32_t converterListSize; 53 uint32_t tagListSize; 54 uint32_t aliasListSize; 55 uint32_t untaggedConvArraySize; 56 uint32_t taggedAliasArraySize; 57 uint32_t taggedAliasListsSize; 58 uint32_t optionTableSize; 59 uint32_t stringTableSize; 60 uint32_t normalizedStringTableSize; 61 } UConverterAlias; 62 63 /** 64 * \var ucnv_io_stripForCompare 65 * Remove the underscores, dashes and spaces from the name, and convert 66 * the name to lower case. 67 * @param dst The destination buffer, which is <= the buffer of name. 68 * @param dst The destination buffer, which is <= the buffer of name. 69 * @see ucnv_compareNames 70 * @return the destination buffer. 71 */ 72 #if U_CHARSET_FAMILY==U_ASCII_FAMILY 73 # define ucnv_io_stripForCompare ucnv_io_stripASCIIForCompare 74 #elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY 75 # define ucnv_io_stripForCompare ucnv_io_stripEBCDICForCompare 76 #else 77 # error U_CHARSET_FAMILY is not valid 78 #endif 79 80 U_CAPI char * U_CALLCONV 81 ucnv_io_stripASCIIForCompare(char *dst, const char *name); 82 83 U_CAPI char * U_CALLCONV 84 ucnv_io_stripEBCDICForCompare(char *dst, const char *name); 85 86 /** 87 * Map a converter alias name to a canonical converter name. 88 * The alias is searched for case-insensitively, the converter name 89 * is returned in mixed-case. 90 * Returns NULL if the alias is not found. 91 * @param alias The alias name to be searched. 92 * @param containsOption A return value stating whether the returned converter name contains an option (a comma) 93 * @param pErrorCode The error code 94 * @return the converter name in mixed-case, return NULL if the alias is not found. 95 */ 96 U_CAPI const char * 97 ucnv_io_getConverterName(const char *alias, UBool *containsOption, UErrorCode *pErrorCode); 98 99 /** 100 * Return the number of all known converter names (no aliases). 101 * @param pErrorCode The error code 102 * @return the number of all aliases 103 */ 104 U_CAPI uint16_t 105 ucnv_io_countKnownConverters(UErrorCode *pErrorCode); 106 107 /** 108 * Swap an ICU converter alias table. See implementation for details. 109 * @internal 110 */ 111 U_CAPI int32_t U_EXPORT2 112 ucnv_swapAliases(const UDataSwapper *ds, 113 const void *inData, int32_t length, void *outData, 114 UErrorCode *pErrorCode); 115 116 #endif 117 118 #endif /* _UCNV_IO */ 119 120 /* 121 * Hey, Emacs, please set the following: 122 * 123 * Local Variables: 124 * indent-tabs-mode: nil 125 * End: 126 * 127 */ 128