]>
Commit | Line | Data |
---|---|---|
f3c0d7a5 A |
1 | // © 2016 and later: Unicode, Inc. and others. |
2 | // License & terms of use: http://www.unicode.org/copyright.html | |
b75a7d8f A |
3 | /* |
4 | ********************************************************************** | |
73c04bcf | 5 | * Copyright (C) 1999-2006, International Business Machines |
b75a7d8f A |
6 | * Corporation and others. All Rights Reserved. |
7 | ********************************************************************** | |
8 | * | |
9 | * | |
10 | * ucnv_io.h: | |
73c04bcf A |
11 | * defines variables and functions pertaining to converter name resolution |
12 | * aspect of the conversion code | |
b75a7d8f A |
13 | */ |
14 | ||
15 | #ifndef UCNV_IO_H | |
16 | #define UCNV_IO_H | |
17 | ||
18 | #include "unicode/utypes.h" | |
19 | ||
374ca955 A |
20 | #if !UCONFIG_NO_CONVERSION |
21 | ||
22 | #include "udataswp.h" | |
23 | ||
b75a7d8f | 24 | #define UCNV_AMBIGUOUS_ALIAS_MAP_BIT 0x8000 |
73c04bcf | 25 | #define UCNV_CONTAINS_OPTION_BIT 0x4000 |
b75a7d8f A |
26 | #define UCNV_CONVERTER_INDEX_MASK 0xFFF |
27 | #define UCNV_NUM_RESERVED_TAGS 2 | |
28 | #define UCNV_NUM_HIDDEN_TAGS 1 | |
29 | ||
73c04bcf A |
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 | ||
b75a7d8f | 63 | /** |
374ca955 | 64 | * \var ucnv_io_stripForCompare |
b75a7d8f A |
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. | |
73c04bcf | 69 | * @see ucnv_compareNames |
b75a7d8f A |
70 | * @return the destination buffer. |
71 | */ | |
374ca955 A |
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 | ||
f3c0d7a5 | 80 | U_CAPI char * U_CALLCONV |
374ca955 A |
81 | ucnv_io_stripASCIIForCompare(char *dst, const char *name); |
82 | ||
f3c0d7a5 | 83 | U_CAPI char * U_CALLCONV |
374ca955 | 84 | ucnv_io_stripEBCDICForCompare(char *dst, const char *name); |
b75a7d8f A |
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. | |
73c04bcf | 92 | * @param containsOption A return value stating whether the returned converter name contains an option (a comma) |
b75a7d8f A |
93 | * @param pErrorCode The error code |
94 | * @return the converter name in mixed-case, return NULL if the alias is not found. | |
95 | */ | |
f3c0d7a5 | 96 | U_CAPI const char * |
73c04bcf | 97 | ucnv_io_getConverterName(const char *alias, UBool *containsOption, UErrorCode *pErrorCode); |
b75a7d8f A |
98 | |
99 | /** | |
46f4442e | 100 | * Return the number of all known converter names (no aliases). |
b75a7d8f A |
101 | * @param pErrorCode The error code |
102 | * @return the number of all aliases | |
103 | */ | |
f3c0d7a5 | 104 | U_CAPI uint16_t |
46f4442e | 105 | ucnv_io_countKnownConverters(UErrorCode *pErrorCode); |
b75a7d8f | 106 | |
374ca955 | 107 | /** |
73c04bcf | 108 | * Swap an ICU converter alias table. See implementation for details. |
374ca955 A |
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 | ||
b75a7d8f A |
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 | */ |