]> git.saurik.com Git - apple/icu.git/blame - icuSources/common/ucnv_io.h
ICU-8.11.4.tar.gz
[apple/icu.git] / icuSources / common / ucnv_io.h
CommitLineData
b75a7d8f
A
1/*
2 **********************************************************************
73c04bcf 3 * Copyright (C) 1999-2006, International Business Machines
b75a7d8f
A
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 *
7 *
8 * ucnv_io.h:
73c04bcf
A
9 * defines variables and functions pertaining to converter name resolution
10 * aspect of the conversion code
b75a7d8f
A
11 */
12
13#ifndef UCNV_IO_H
14#define UCNV_IO_H
15
16#include "unicode/utypes.h"
17
374ca955
A
18#if !UCONFIG_NO_CONVERSION
19
20#include "udataswp.h"
21
b75a7d8f 22#define UCNV_AMBIGUOUS_ALIAS_MAP_BIT 0x8000
73c04bcf 23#define UCNV_CONTAINS_OPTION_BIT 0x4000
b75a7d8f
A
24#define UCNV_CONVERTER_INDEX_MASK 0xFFF
25#define UCNV_NUM_RESERVED_TAGS 2
26#define UCNV_NUM_HIDDEN_TAGS 1
27
73c04bcf
A
28enum {
29 UCNV_IO_UNNORMALIZED,
30 UCNV_IO_STD_NORMALIZED,
31 UCNV_IO_NORM_TYPE_COUNT
32};
33
34typedef struct {
35 uint16_t stringNormalizationType;
36 uint16_t containsCnvOptionInfo;
37} UConverterAliasOptions;
38
39typedef 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
b75a7d8f 61/**
374ca955 62 * \var ucnv_io_stripForCompare
b75a7d8f
A
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.
73c04bcf 67 * @see ucnv_compareNames
b75a7d8f
A
68 * @return the destination buffer.
69 */
374ca955
A
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
73c04bcf 78U_CAPI char * U_EXPORT2
374ca955
A
79ucnv_io_stripASCIIForCompare(char *dst, const char *name);
80
73c04bcf 81U_CAPI char * U_EXPORT2
374ca955 82ucnv_io_stripEBCDICForCompare(char *dst, const char *name);
b75a7d8f
A
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.
73c04bcf 90 * @param containsOption A return value stating whether the returned converter name contains an option (a comma)
b75a7d8f
A
91 * @param pErrorCode The error code
92 * @return the converter name in mixed-case, return NULL if the alias is not found.
93 */
94U_CFUNC const char *
73c04bcf 95ucnv_io_getConverterName(const char *alias, UBool *containsOption, UErrorCode *pErrorCode);
b75a7d8f
A
96
97/**
73c04bcf
A
98 * Return the number of all aliases and converter names.
99 * This is helpful if you need a number for creating an alias table.
b75a7d8f
A
100 * @param pErrorCode The error code
101 * @return the number of all aliases
102 */
103U_CFUNC uint16_t
73c04bcf 104ucnv_io_countTotalAliases(UErrorCode *pErrorCode);
b75a7d8f 105
374ca955 106/**
73c04bcf 107 * Swap an ICU converter alias table. See implementation for details.
374ca955
A
108 * @internal
109 */
110U_CAPI int32_t U_EXPORT2
111ucnv_swapAliases(const UDataSwapper *ds,
112 const void *inData, int32_t length, void *outData,
113 UErrorCode *pErrorCode);
114
115#endif
116
b75a7d8f
A
117#endif /* _UCNV_IO */
118
119/*
120 * Hey, Emacs, please set the following:
121 *
122 * Local Variables:
123 * indent-tabs-mode: nil
124 * End:
125 *
126 */