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