michael@0: /* michael@0: ********************************************************************** michael@0: * Copyright (C) 1999-2006, International Business Machines michael@0: * Corporation and others. All Rights Reserved. michael@0: ********************************************************************** michael@0: * michael@0: * michael@0: * ucnv_io.h: michael@0: * defines variables and functions pertaining to converter name resolution michael@0: * aspect of the conversion code michael@0: */ michael@0: michael@0: #ifndef UCNV_IO_H michael@0: #define UCNV_IO_H michael@0: michael@0: #include "unicode/utypes.h" michael@0: michael@0: #if !UCONFIG_NO_CONVERSION michael@0: michael@0: #include "udataswp.h" michael@0: michael@0: #define UCNV_AMBIGUOUS_ALIAS_MAP_BIT 0x8000 michael@0: #define UCNV_CONTAINS_OPTION_BIT 0x4000 michael@0: #define UCNV_CONVERTER_INDEX_MASK 0xFFF michael@0: #define UCNV_NUM_RESERVED_TAGS 2 michael@0: #define UCNV_NUM_HIDDEN_TAGS 1 michael@0: michael@0: enum { michael@0: UCNV_IO_UNNORMALIZED, michael@0: UCNV_IO_STD_NORMALIZED, michael@0: UCNV_IO_NORM_TYPE_COUNT michael@0: }; michael@0: michael@0: typedef struct { michael@0: uint16_t stringNormalizationType; michael@0: uint16_t containsCnvOptionInfo; michael@0: } UConverterAliasOptions; michael@0: michael@0: typedef struct UConverterAlias { michael@0: const uint16_t *converterList; michael@0: const uint16_t *tagList; michael@0: const uint16_t *aliasList; michael@0: const uint16_t *untaggedConvArray; michael@0: const uint16_t *taggedAliasArray; michael@0: const uint16_t *taggedAliasLists; michael@0: const UConverterAliasOptions *optionTable; michael@0: const uint16_t *stringTable; michael@0: const uint16_t *normalizedStringTable; michael@0: michael@0: uint32_t converterListSize; michael@0: uint32_t tagListSize; michael@0: uint32_t aliasListSize; michael@0: uint32_t untaggedConvArraySize; michael@0: uint32_t taggedAliasArraySize; michael@0: uint32_t taggedAliasListsSize; michael@0: uint32_t optionTableSize; michael@0: uint32_t stringTableSize; michael@0: uint32_t normalizedStringTableSize; michael@0: } UConverterAlias; michael@0: michael@0: /** michael@0: * \var ucnv_io_stripForCompare michael@0: * Remove the underscores, dashes and spaces from the name, and convert michael@0: * the name to lower case. michael@0: * @param dst The destination buffer, which is <= the buffer of name. michael@0: * @param dst The destination buffer, which is <= the buffer of name. michael@0: * @see ucnv_compareNames michael@0: * @return the destination buffer. michael@0: */ michael@0: #if U_CHARSET_FAMILY==U_ASCII_FAMILY michael@0: # define ucnv_io_stripForCompare ucnv_io_stripASCIIForCompare michael@0: #elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY michael@0: # define ucnv_io_stripForCompare ucnv_io_stripEBCDICForCompare michael@0: #else michael@0: # error U_CHARSET_FAMILY is not valid michael@0: #endif michael@0: michael@0: U_CAPI char * U_EXPORT2 michael@0: ucnv_io_stripASCIIForCompare(char *dst, const char *name); michael@0: michael@0: U_CAPI char * U_EXPORT2 michael@0: ucnv_io_stripEBCDICForCompare(char *dst, const char *name); michael@0: michael@0: /** michael@0: * Map a converter alias name to a canonical converter name. michael@0: * The alias is searched for case-insensitively, the converter name michael@0: * is returned in mixed-case. michael@0: * Returns NULL if the alias is not found. michael@0: * @param alias The alias name to be searched. michael@0: * @param containsOption A return value stating whether the returned converter name contains an option (a comma) michael@0: * @param pErrorCode The error code michael@0: * @return the converter name in mixed-case, return NULL if the alias is not found. michael@0: */ michael@0: U_CFUNC const char * michael@0: ucnv_io_getConverterName(const char *alias, UBool *containsOption, UErrorCode *pErrorCode); michael@0: michael@0: /** michael@0: * Return the number of all known converter names (no aliases). michael@0: * @param pErrorCode The error code michael@0: * @return the number of all aliases michael@0: */ michael@0: U_CFUNC uint16_t michael@0: ucnv_io_countKnownConverters(UErrorCode *pErrorCode); michael@0: michael@0: /** michael@0: * Swap an ICU converter alias table. See implementation for details. michael@0: * @internal michael@0: */ michael@0: U_CAPI int32_t U_EXPORT2 michael@0: ucnv_swapAliases(const UDataSwapper *ds, michael@0: const void *inData, int32_t length, void *outData, michael@0: UErrorCode *pErrorCode); michael@0: michael@0: #endif michael@0: michael@0: #endif /* _UCNV_IO */ michael@0: michael@0: /* michael@0: * Hey, Emacs, please set the following: michael@0: * michael@0: * Local Variables: michael@0: * indent-tabs-mode: nil michael@0: * End: michael@0: * michael@0: */