]> gitweb.fperrin.net Git - Dictionary.git/blob - jars/icu4j-4_4_2-src/main/classes/charset/src/com/ibm/icu/charset/UConverterConstants.java
go
[Dictionary.git] / jars / icu4j-4_4_2-src / main / classes / charset / src / com / ibm / icu / charset / UConverterConstants.java
1 /*\r
2 *******************************************************************************\r
3 * Copyright (C) 2006-2008, International Business Machines Corporation and    *\r
4 * others. All Rights Reserved.                                                *\r
5 *******************************************************************************\r
6 */ \r
7 package com.ibm.icu.charset;\r
8 \r
9 interface UConverterConstants {\r
10 \r
11     static final short UNSIGNED_BYTE_MASK = 0xff;\r
12     static final int UNSIGNED_SHORT_MASK = 0xffff;\r
13     static final long UNSIGNED_INT_MASK = 0xffffffffL;\r
14     \r
15     static final int U_IS_BIG_ENDIAN = 0;\r
16 \r
17     /**\r
18      * Useful constant for the maximum size of the whole locale ID\r
19      * (including the terminating NULL).\r
20      */\r
21     static final int ULOC_FULLNAME_CAPACITY = 56;\r
22 \r
23     /**\r
24      * This value is intended for sentinel values for APIs that\r
25      * (take or) return single code points (UChar32).\r
26      * It is outside of the Unicode code point range 0..0x10ffff.\r
27      * \r
28      * For example, a "done" or "error" value in a new API\r
29      * could be indicated with U_SENTINEL.\r
30      *\r
31      * ICU APIs designed before ICU 2.4 usually define service-specific "done"\r
32      * values, mostly 0xffff.\r
33      * Those may need to be distinguished from\r
34      * actual U+ffff text contents by calling functions like\r
35      * CharacterIterator::hasNext() or UnicodeString::length().\r
36      */\r
37     static final int U_SENTINEL = -1;\r
38 \r
39     //end utf.h\r
40 \r
41     //begin ucnv.h\r
42     /**\r
43      * Character that separates converter names from options and options from each other.\r
44      * @see CharsetICU#forNameICU(String)\r
45      */\r
46     static final byte OPTION_SEP_CHAR  = ',';\r
47 \r
48     /** Maximum length of a converter name including the terminating NULL */\r
49     static final int MAX_CONVERTER_NAME_LENGTH  = 60;\r
50     /** Maximum length of a converter name including path and terminating NULL */\r
51     static final int MAX_FULL_FILE_NAME_LENGTH = (600+MAX_CONVERTER_NAME_LENGTH);\r
52 \r
53     /** Shift in for EBDCDIC_STATEFUL and iso2022 states */\r
54     static final int SI = 0x0F;\r
55     /** Shift out for EBDCDIC_STATEFUL and iso2022 states */\r
56     static final int SO = 0x0E;\r
57 \r
58     //end ucnv.h\r
59 \r
60     // begin bld.h\r
61     /* size of the overflow buffers in UConverter, enough for escaping callbacks */\r
62     //#define ERROR_BUFFER_LENGTH 32\r
63     static final int ERROR_BUFFER_LENGTH = 32;\r
64 \r
65     /* at most 4 bytes per substitution character (part of .cnv file format! see UConverterStaticData) */\r
66     static final int MAX_SUBCHAR_LEN = 4;\r
67 \r
68     /* at most 8 bytes per character in toUBytes[] (UTF-8 uses up to 6) */\r
69     static final int MAX_CHAR_LEN = 8;\r
70 \r
71     /* converter options bits */\r
72     static final int OPTION_VERSION     = 0xf;\r
73     static final int OPTION_SWAP_LFNL   = 0x10;\r
74     static final int OPTION_MAC   = 0x20; //agljport:comment added for Mac ISCII encodings\r
75 \r
76     static final String OPTION_SWAP_LFNL_STRING = ",swaplfnl";\r
77 \r
78     /** values for the unicodeMask */\r
79     static final int HAS_SUPPLEMENTARY = 1;\r
80     static final int HAS_SURROGATES =   2;\r
81     // end bld.h\r
82 \r
83     // begin cnv.h\r
84     /* this is used in fromUnicode DBCS tables as an "unassigned" marker */\r
85     static final int missingCharMarker = 0xFFFF;\r
86      /**\r
87       * \r
88       * @author ram\r
89       */\r
90     static interface UConverterResetChoice {\r
91         static final int RESET_BOTH = 0;\r
92         static final int RESET_TO_UNICODE = RESET_BOTH + 1;\r
93         static final int RESET_FROM_UNICODE = RESET_TO_UNICODE + 1;\r
94     }\r
95 \r
96     // begin utf16.h\r
97     /**\r
98      * The maximum number of 16-bit code units per Unicode code point (U+0000..U+10ffff).\r
99      */\r
100     static final int U16_MAX_LENGTH = 2;\r
101     // end utf16.h\r
102 \r
103     // begin err.h\r
104     /**\r
105      * FROM_U, TO_U context options for sub callback\r
106      */\r
107     static byte[] SUB_STOP_ON_ILLEGAL = {'i'};\r
108 \r
109     /**\r
110      * FROM_U, TO_U context options for skip callback\r
111      */\r
112     static byte[] SKIP_STOP_ON_ILLEGAL = {'i'};\r
113 \r
114     /** \r
115      * The process condition code to be used with the callbacks.  \r
116      * Codes which are greater than IRREGULAR should be \r
117      * passed on to any chained callbacks.\r
118      */\r
119     static interface UConverterCallbackReason {\r
120          static final int UNASSIGNED = 0;  /**< The code point is unassigned.\r
121                                  The error code U_INVALID_CHAR_FOUND will be set. */\r
122          static final int ILLEGAL = 1;     /**< The code point is illegal. For example, \r
123                                  \\x81\\x2E is illegal in SJIS because \\x2E\r
124                                  is not a valid trail byte for the \\x81 \r
125                                  lead byte.\r
126                                  Also, starting with Unicode 3.0.1, non-shortest byte sequences\r
127                                  in UTF-8 (like \\xC1\\xA1 instead of \\x61 for U+0061)\r
128                                  are also illegal, not just irregular.\r
129                                  The error code U_ILLEGAL_CHAR_FOUND will be set. */\r
130          static final int IRREGULAR = 2;   /**< The codepoint is not a regular sequence in \r
131                                  the encoding. For example, \\xED\\xA0\\x80..\\xED\\xBF\\xBF\r
132                                  are irregular UTF-8 byte sequences for single surrogate\r
133                                  code points.\r
134                                  The error code U_INVALID_CHAR_FOUND will be set. */\r
135          static final int RESET = 3;       /**< The callback is called with this reason when a\r
136                                  'reset' has occured. Callback should reset all\r
137                                  state. */\r
138          static final int CLOSE = 4;        /**< Called when the converter is closed. The\r
139                                  callback should release any allocated memory.*/\r
140          static final int CLONE = 5;         /**< Called when safeClone() is called on the\r
141                                   converter. the pointer available as the\r
142                                   'context' is an alias to the original converters'\r
143                                   context pointer. If the context must be owned\r
144                                   by the new converter, the callback must clone \r
145                                   the data and call setFromUCallback \r
146                                   (or setToUCallback) with the correct pointer.\r
147                                */\r
148     }\r
149     //end err.h\r
150 \r
151 \r
152     static final String DATA_TYPE = "cnv";\r
153     static final int CNV_DATA_BUFFER_SIZE = 25000;\r
154     static final int SIZE_OF_UCONVERTER_SHARED_DATA = 100;\r
155 \r
156     static final int MAXIMUM_UCS2 =            0x0000FFFF;\r
157     static final int MAXIMUM_UTF =             0x0010FFFF;\r
158     //static final int MAXIMUM_UCS4 =            0x7FFFFFFF;\r
159     static final int HALF_SHIFT =              10;\r
160     static final int HALF_BASE =               0x0010000;\r
161     static final int HALF_MASK =               0x3FF;\r
162     static final int SURROGATE_HIGH_START =    0xD800;\r
163     static final int SURROGATE_HIGH_END =      0xDBFF;\r
164     static final int SURROGATE_LOW_START =     0xDC00;\r
165     static final int SURROGATE_LOW_END =       0xDFFF;\r
166     \r
167     /* -SURROGATE_LOW_START + HALF_BASE */\r
168     static final int SURROGATE_LOW_BASE =      9216;\r
169 }\r