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