]> git.saurik.com Git - apple/icu.git/blame - icuSources/common/ucnv_io.h
ICU-400.37.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/**
46f4442e 98 * Return the number of all known converter names (no aliases).
b75a7d8f
A
99 * @param pErrorCode The error code
100 * @return the number of all aliases
101 */
102U_CFUNC uint16_t
46f4442e 103ucnv_io_countKnownConverters(UErrorCode *pErrorCode);
b75a7d8f 104
374ca955 105/**
73c04bcf 106 * Swap an ICU converter alias table. See implementation for details.
374ca955
A
107 * @internal
108 */
109U_CAPI int32_t U_EXPORT2
110ucnv_swapAliases(const UDataSwapper *ds,
111 const void *inData, int32_t length, void *outData,
112 UErrorCode *pErrorCode);
113
114#endif
115
b75a7d8f
A
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 */