]> git.saurik.com Git - apple/icu.git/blob - icuSources/common/ucnv_io.h
ICU-6.2.4.tar.gz
[apple/icu.git] / icuSources / common / ucnv_io.h
1 /*
2 **********************************************************************
3 * Copyright (C) 1999-2004, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 *
7 *
8 * ucnv_io.h:
9 * defines variables and functions pertaining to file access, and name resolution
10 * aspect of the library
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_CONVERTER_INDEX_MASK 0xFFF
24 #define UCNV_NUM_RESERVED_TAGS 2
25 #define UCNV_NUM_HIDDEN_TAGS 1
26
27 /**
28 * \var ucnv_io_stripForCompare
29 * Remove the underscores, dashes and spaces from the name, and convert
30 * the name to lower case.
31 * @param dst The destination buffer, which is <= the buffer of name.
32 * @param dst The destination buffer, which is <= the buffer of name.
33 * @return the destination buffer.
34 */
35 #if U_CHARSET_FAMILY==U_ASCII_FAMILY
36 # define ucnv_io_stripForCompare ucnv_io_stripASCIIForCompare
37 #elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
38 # define ucnv_io_stripForCompare ucnv_io_stripEBCDICForCompare
39 #else
40 # error U_CHARSET_FAMILY is not valid
41 #endif
42
43 U_CFUNC char * U_EXPORT2
44 ucnv_io_stripASCIIForCompare(char *dst, const char *name);
45
46 U_CFUNC char * U_EXPORT2
47 ucnv_io_stripEBCDICForCompare(char *dst, const char *name);
48
49 /**
50 * Map a converter alias name to a canonical converter name.
51 * The alias is searched for case-insensitively, the converter name
52 * is returned in mixed-case.
53 * Returns NULL if the alias is not found.
54 * @param alias The alias name to be searched.
55 * @param pErrorCode The error code
56 * @return the converter name in mixed-case, return NULL if the alias is not found.
57 */
58 U_CFUNC const char *
59 ucnv_io_getConverterName(const char *alias, UErrorCode *pErrorCode);
60
61 /**
62 * The count for ucnv_io_getAliases and ucnv_io_getAlias
63 * @param alias The alias name to be counted
64 * @param pErrorCode The error code
65 * @return the alias count
66 */
67 U_CFUNC uint16_t
68 ucnv_io_countAliases(const char *alias, UErrorCode *pErrorCode);
69
70 /**
71 * Search case-insensitively for a converter alias and set aliases to
72 * a pointer to the list of aliases for the actual converter.
73 * The first "alias" is the canonical converter name.
74 * The aliases are stored consecutively, in mixed case, each NUL-terminated.
75 * There are as many strings in this list as the return value specifies.
76 * Returns the number of aliases including the canonical converter name,
77 * or 0 if the alias is not found.
78 * @param alias The canonical converter name
79 * @param start
80 * @param aliases A pointer to the list of aliases for the actual converter
81 * @return the number of aliases including the canonical converter name, or 0 if the alias is not found.
82 */
83 U_CFUNC uint16_t
84 ucnv_io_getAliases(const char *alias, uint16_t start, const char **aliases, UErrorCode *pErrorCode);
85
86 /**
87 * Search case-insensitively for a converter alias and return
88 * the (n)th alias.
89 * Returns NULL if the alias is not found.
90 * @param alias The converter alias
91 * @param n The number specifies which alias to get
92 * @param pErrorCode The error code
93 * @return the (n)th alias and return NULL if the alias is not found.
94 */
95 U_CFUNC const char *
96 ucnv_io_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode);
97
98 /**
99 * Return the number of all standard names.
100 * @param pErrorCode The error code
101 * @return the number of all standard names
102 */
103 U_CFUNC uint16_t
104 ucnv_io_countStandards(UErrorCode *pErrorCode);
105
106 /**
107 * Return the number of all converter names.
108 * @param pErrorCode The error code
109 * @return the number of all converter names
110 */
111 U_CFUNC uint16_t
112 ucnv_io_countAvailableConverters(UErrorCode *pErrorCode);
113
114 /**
115 * Return the (n)th converter name in mixed case, or NULL
116 * if there is none (typically, if the data cannot be loaded).
117 * 0<=index<ucnv_io_countAvailableConverters().
118 * @param n The number specifies which converter name to get
119 * @param pErrorCode The error code
120 * @return the (n)th converter name in mixed case, or NULL if there is none.
121 */
122 U_CFUNC const char *
123 ucnv_io_getAvailableConverter(uint16_t n, UErrorCode *pErrorCode);
124
125 /**
126 * Return the (n)th converter name in mixed case, or NULL
127 * if there is none (typically, if the data cannot be loaded).
128 * 0<=index<ucnv_io_countAvailableConverters().
129 */
130 U_CFUNC void
131 ucnv_io_flushAvailableConverterCache(void);
132
133 /**
134 * Return the number of all aliases (and converter names).
135 * @param pErrorCode The error code
136 * @return the number of all aliases
137 */
138 U_CFUNC uint16_t
139 ucnv_io_countAvailableAliases(UErrorCode *pErrorCode);
140
141 /**
142 * Get the name of the default converter.
143 * This name is already resolved by <code>ucnv_io_getConverterName()</code>.
144 * @return the name of the default converter
145 */
146 U_CFUNC const char *
147 ucnv_io_getDefaultConverterName(void);
148
149 /**
150 * Set the name of the default converter.
151 * @param name The name set to the default converter
152 */
153 U_CFUNC void
154 ucnv_io_setDefaultConverterName(const char *name);
155
156 /**
157 * Swap an ICU converter alias table. See ucnv_io.c.
158 * @internal
159 */
160 U_CAPI int32_t U_EXPORT2
161 ucnv_swapAliases(const UDataSwapper *ds,
162 const void *inData, int32_t length, void *outData,
163 UErrorCode *pErrorCode);
164
165 #endif
166
167 #endif /* _UCNV_IO */
168
169 /*
170 * Hey, Emacs, please set the following:
171 *
172 * Local Variables:
173 * indent-tabs-mode: nil
174 * End:
175 *
176 */