LEInsertionList
20 | * to apply an insertion from the insertion list.
21 | *
22 | * @internal
23 | */
24 | class U_LAYOUT_API LEInsertionCallback
25 | {
26 | public:
27 | /**
28 | * This method will be called by LEInsertionList::applyInsertions
for each
29 | * entry on the insertion list.
30 | *
31 | * @param atPosition the position of the insertion
32 | * @param count the number of glyphs to insert
33 | * @param newGlyphs the address of the glyphs to insert
34 | *
35 | * @return TRUE
if LEInsertions::applyInsertions
should
36 | * stop after applying this insertion.
37 | *
38 | * @internal
39 | */
40 | virtual le_bool applyInsertion(le_int32 atPosition, le_int32 count, LEGlyphID newGlyphs[]) = 0;
41 |
42 | /**
43 | * The destructor
44 | */
45 | virtual ~LEInsertionCallback();
46 | };
47 |
48 | /**
49 | * This class is used to keep track of insertions to an array of
50 | * LEGlyphIDs
. The insertions are kept on a linked
51 | * list of InsertionRecords
so that the glyph array
52 | * doesn't have to be grown for each insertion. The insertions are
53 | * stored on the list from leftmost to rightmost to make it easier
54 | * to do the insertions.
55 | *
56 | * The insertions are applied to the array by calling the
57 | * applyInsertions
method, which calls a client
58 | * supplied LEInsertionCallback
object to actually
59 | * apply the individual insertions.
60 | *
61 | * @internal
62 | */
63 | class LEInsertionList : public UObject
64 | {
65 | public:
66 | /**
67 | * Construct an empty insertion list.
68 | *
69 | * @param rightToLeft TRUE
if the glyphs are stored
70 | * in the array in right to left order.
71 | *
72 | * @internal
73 | */
74 | LEInsertionList(le_bool rightToLeft);
75 |
76 | /**
77 | * The destructor.
78 | */
79 | ~LEInsertionList();
80 |
81 | /**
82 | * Add an entry to the insertion list.
83 | *
84 | * @param position the glyph at this position in the array will be
85 | * replaced by the new glyphs.
86 | * @param count the number of new glyphs
87 | * @param success set to an error code if the auxillary data cannot be retrieved.
88 | *
89 | * @return the address of an array in which to store the new glyphs. This will
90 | * not be in the glyph array.
91 | *
92 | * @internal
93 | */
94 | LEGlyphID *insert(le_int32 position, le_int32 count, LEErrorCode &success);
95 |
96 | /**
97 | * Return the number of new glyphs that have been inserted.
98 | *
99 | * @return the number of new glyphs which have been inserted
100 | *
101 | * @internal
102 | */
103 | le_int32 getGrowAmount();
104 |
105 | /**
106 | * Call the LEInsertionCallback
once for each
107 | * entry on the insertion list.
108 | *
109 | * @param callback the LEInsertionCallback
to call for each insertion.
110 | *
111 | * @return TRUE
if callback
returned TRUE
to
112 | * terminate the insertion list processing.
113 | *
114 | * @internal
115 | */
116 | le_bool applyInsertions(LEInsertionCallback *callback);
117 |
118 | /**
119 | * Empty the insertion list and free all associated
120 | * storage.
121 | *
122 | * @internal
123 | */
124 | void reset();
125 |
126 | /**
127 | * ICU "poor man's RTTI", returns a UClassID for the actual class.
128 | *
129 | * @deprecated ICU 54. See {@link icu::LayoutEngine}
130 | */
131 | virtual UClassID getDynamicClassID() const;
132 |
133 | /**
134 | * ICU "poor man's RTTI", returns a UClassID for this class.
135 | *
136 | * @deprecated ICU 54. See {@link icu::LayoutEngine}
137 | */
138 | static UClassID getStaticClassID();
139 |
140 | private:
141 |
142 | /**
143 | * The head of the insertion list.
144 | *
145 | * @internal
146 | */
147 | InsertionRecord *head;
148 |
149 | /**
150 | * The tail of the insertion list.
151 | *
152 | * @internal
153 | */
154 | InsertionRecord *tail;
155 |
156 | /**
157 | * The total number of new glyphs on the insertion list.
158 | *
159 | * @internal
160 | */
161 | le_int32 growAmount;
162 |
163 | /**
164 | * Set to TRUE
if the glyphs are in right
165 | * to left order. Since we want the rightmost insertion
166 | * to be first on the list, we need to append the
167 | * insertions in this case. Otherwise they're prepended.
168 | *
169 | * @internal
170 | */
171 | le_bool append;
172 | };
173 | #endif /* U_HIDE_INTERNAL_API */
174 |
175 | U_NAMESPACE_END
176 | #endif
177 |
178 |
--------------------------------------------------------------------------------
/3rd/include/icu/layout/LELanguages.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * (C) Copyright IBM Corp. 1998-2014. All Rights Reserved.
4 | *
5 | * WARNING: THIS FILE IS MACHINE GENERATED. DO NOT HAND EDIT IT UNLESS
6 | * YOU REALLY KNOW WHAT YOU'RE DOING.
7 | *
8 | * Generated on: 10/26/2010 02:53:33 PM PDT
9 | */
10 |
11 | #ifndef __LELANGUAGES_H
12 | #define __LELANGUAGES_H
13 |
14 | #include "LETypes.h"
15 |
16 | /**
17 | * \file
18 | * \brief C++ API: List of language codes for LayoutEngine
19 | */
20 |
21 | U_NAMESPACE_BEGIN
22 |
23 | /**
24 | * A provisional list of language codes. For now,
25 | * this is just a list of languages which the LayoutEngine
26 | * supports.
27 | *
28 | * @deprecated ICU 54. See {@link icu::LayoutEngine}
29 | */
30 |
31 | enum LanguageCodes {
32 | nullLanguageCode = 0,
33 | araLanguageCode = 1,
34 | asmLanguageCode = 2,
35 | benLanguageCode = 3,
36 | farLanguageCode = 4,
37 | gujLanguageCode = 5,
38 | hinLanguageCode = 6,
39 | iwrLanguageCode = 7,
40 | jiiLanguageCode = 8,
41 | janLanguageCode = 9,
42 | kanLanguageCode = 10,
43 | kokLanguageCode = 11,
44 | korLanguageCode = 12,
45 | kshLanguageCode = 13,
46 | malLanguageCode = 14,
47 | marLanguageCode = 15,
48 | mlrLanguageCode = 16,
49 | mniLanguageCode = 17,
50 | oriLanguageCode = 18,
51 | sanLanguageCode = 19,
52 | sndLanguageCode = 20,
53 | snhLanguageCode = 21,
54 | syrLanguageCode = 22,
55 | tamLanguageCode = 23,
56 | telLanguageCode = 24,
57 | thaLanguageCode = 25,
58 | urdLanguageCode = 26,
59 | zhpLanguageCode = 27,
60 | zhsLanguageCode = 28,
61 | zhtLanguageCode = 29,
62 |
63 | /** New language codes added 03/13/2008 @deprecated ICU 54. See {@link icu::LayoutEngine}
64 | */
65 | afkLanguageCode = 30,
66 | belLanguageCode = 31,
67 | bgrLanguageCode = 32,
68 | catLanguageCode = 33,
69 | cheLanguageCode = 34,
70 | copLanguageCode = 35,
71 | csyLanguageCode = 36,
72 | danLanguageCode = 37,
73 | deuLanguageCode = 38,
74 | dznLanguageCode = 39,
75 | ellLanguageCode = 40,
76 | engLanguageCode = 41,
77 | espLanguageCode = 42,
78 | etiLanguageCode = 43,
79 | euqLanguageCode = 44,
80 | finLanguageCode = 45,
81 | fraLanguageCode = 46,
82 | gaeLanguageCode = 47,
83 | hauLanguageCode = 48,
84 | hrvLanguageCode = 49,
85 | hunLanguageCode = 50,
86 | hyeLanguageCode = 51,
87 | indLanguageCode = 52,
88 | itaLanguageCode = 53,
89 | khmLanguageCode = 54,
90 | mngLanguageCode = 55,
91 | mtsLanguageCode = 56,
92 | nepLanguageCode = 57,
93 | nldLanguageCode = 58,
94 | pasLanguageCode = 59,
95 | plkLanguageCode = 60,
96 | ptgLanguageCode = 61,
97 | romLanguageCode = 62,
98 | rusLanguageCode = 63,
99 | skyLanguageCode = 64,
100 | slvLanguageCode = 65,
101 | sqiLanguageCode = 66,
102 | srbLanguageCode = 67,
103 | sveLanguageCode = 68,
104 | tibLanguageCode = 69,
105 | trkLanguageCode = 70,
106 | welLanguageCode = 71,
107 |
108 | languageCodeCount = 72
109 | };
110 |
111 | U_NAMESPACE_END
112 | #endif
113 |
--------------------------------------------------------------------------------
/3rd/include/icu/layout/LEScripts.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * (C) Copyright IBM Corp. 1998-2014. All Rights Reserved.
4 | *
5 | * WARNING: THIS FILE IS MACHINE GENERATED. DO NOT HAND EDIT IT UNLESS
6 | * YOU REALLY KNOW WHAT YOU'RE DOING.
7 | *
8 | * Generated on: 04/08/2014 03:20:04 PM PDT
9 | */
10 |
11 | #ifndef __LESCRIPTS_H
12 | #define __LESCRIPTS_H
13 |
14 | #include "LETypes.h"
15 |
16 | /**
17 | * \file
18 | * \brief C++ API: Constants for Unicode script values
19 | */
20 |
21 | U_NAMESPACE_BEGIN
22 |
23 | /**
24 | * Constants for Unicode script values, generated using
25 | * ICU4J's UScript
class.
26 | *
27 | * @deprecated ICU 54. See {@link icu::LayoutEngine}
28 | */
29 |
30 | enum ScriptCodes {
31 | zyyyScriptCode = 0,
32 | zinhScriptCode = 1,
33 | qaaiScriptCode = zinhScriptCode, /* manually added alias, for API stability */
34 | arabScriptCode = 2,
35 | armnScriptCode = 3,
36 | bengScriptCode = 4,
37 | bopoScriptCode = 5,
38 | cherScriptCode = 6,
39 | coptScriptCode = 7,
40 | cyrlScriptCode = 8,
41 | dsrtScriptCode = 9,
42 | devaScriptCode = 10,
43 | ethiScriptCode = 11,
44 | georScriptCode = 12,
45 | gothScriptCode = 13,
46 | grekScriptCode = 14,
47 | gujrScriptCode = 15,
48 | guruScriptCode = 16,
49 | haniScriptCode = 17,
50 | hangScriptCode = 18,
51 | hebrScriptCode = 19,
52 | hiraScriptCode = 20,
53 | kndaScriptCode = 21,
54 | kanaScriptCode = 22,
55 | khmrScriptCode = 23,
56 | laooScriptCode = 24,
57 | latnScriptCode = 25,
58 | mlymScriptCode = 26,
59 | mongScriptCode = 27,
60 | mymrScriptCode = 28,
61 | ogamScriptCode = 29,
62 | italScriptCode = 30,
63 | oryaScriptCode = 31,
64 | runrScriptCode = 32,
65 | sinhScriptCode = 33,
66 | syrcScriptCode = 34,
67 | tamlScriptCode = 35,
68 | teluScriptCode = 36,
69 | thaaScriptCode = 37,
70 | thaiScriptCode = 38,
71 | tibtScriptCode = 39,
72 | /**
73 | * @deprecated ICU 54. See {@link icu::LayoutEngine}
74 | */
75 |
76 | cansScriptCode = 40,
77 | /**
78 | * @deprecated ICU 54. See {@link icu::LayoutEngine}
79 | */
80 |
81 | yiiiScriptCode = 41,
82 | tglgScriptCode = 42,
83 | hanoScriptCode = 43,
84 | buhdScriptCode = 44,
85 | tagbScriptCode = 45,
86 | /**
87 | * @deprecated ICU 54. See {@link icu::LayoutEngine}
88 | */
89 |
90 | braiScriptCode = 46,
91 | cprtScriptCode = 47,
92 | limbScriptCode = 48,
93 | linbScriptCode = 49,
94 | osmaScriptCode = 50,
95 | shawScriptCode = 51,
96 | taleScriptCode = 52,
97 | ugarScriptCode = 53,
98 | /**
99 | * @deprecated ICU 54. See {@link icu::LayoutEngine}
100 | */
101 |
102 | hrktScriptCode = 54,
103 | /**
104 | * @deprecated ICU 54. See {@link icu::LayoutEngine}
105 | */
106 |
107 | bugiScriptCode = 55,
108 | glagScriptCode = 56,
109 | kharScriptCode = 57,
110 | syloScriptCode = 58,
111 | taluScriptCode = 59,
112 | tfngScriptCode = 60,
113 | xpeoScriptCode = 61,
114 | /**
115 | * @deprecated ICU 54. See {@link icu::LayoutEngine}
116 | */
117 |
118 | baliScriptCode = 62,
119 | batkScriptCode = 63,
120 | blisScriptCode = 64,
121 | brahScriptCode = 65,
122 | chamScriptCode = 66,
123 | cirtScriptCode = 67,
124 | cyrsScriptCode = 68,
125 | egydScriptCode = 69,
126 | egyhScriptCode = 70,
127 | egypScriptCode = 71,
128 | geokScriptCode = 72,
129 | hansScriptCode = 73,
130 | hantScriptCode = 74,
131 | hmngScriptCode = 75,
132 | hungScriptCode = 76,
133 | indsScriptCode = 77,
134 | javaScriptCode = 78,
135 | kaliScriptCode = 79,
136 | latfScriptCode = 80,
137 | latgScriptCode = 81,
138 | lepcScriptCode = 82,
139 | linaScriptCode = 83,
140 | mandScriptCode = 84,
141 | mayaScriptCode = 85,
142 | meroScriptCode = 86,
143 | nkooScriptCode = 87,
144 | orkhScriptCode = 88,
145 | permScriptCode = 89,
146 | phagScriptCode = 90,
147 | phnxScriptCode = 91,
148 | plrdScriptCode = 92,
149 | roroScriptCode = 93,
150 | saraScriptCode = 94,
151 | syreScriptCode = 95,
152 | syrjScriptCode = 96,
153 | syrnScriptCode = 97,
154 | tengScriptCode = 98,
155 | vaiiScriptCode = 99,
156 | vispScriptCode = 100,
157 | xsuxScriptCode = 101,
158 | zxxxScriptCode = 102,
159 | zzzzScriptCode = 103,
160 | /**
161 | * @deprecated ICU 54. See {@link icu::LayoutEngine}
162 | */
163 |
164 | cariScriptCode = 104,
165 | jpanScriptCode = 105,
166 | lanaScriptCode = 106,
167 | lyciScriptCode = 107,
168 | lydiScriptCode = 108,
169 | olckScriptCode = 109,
170 | rjngScriptCode = 110,
171 | saurScriptCode = 111,
172 | sgnwScriptCode = 112,
173 | sundScriptCode = 113,
174 | moonScriptCode = 114,
175 | mteiScriptCode = 115,
176 | /**
177 | * @deprecated ICU 54. See {@link icu::LayoutEngine}
178 | */
179 |
180 | armiScriptCode = 116,
181 | avstScriptCode = 117,
182 | cakmScriptCode = 118,
183 | koreScriptCode = 119,
184 | kthiScriptCode = 120,
185 | maniScriptCode = 121,
186 | phliScriptCode = 122,
187 | phlpScriptCode = 123,
188 | phlvScriptCode = 124,
189 | prtiScriptCode = 125,
190 | samrScriptCode = 126,
191 | tavtScriptCode = 127,
192 | zmthScriptCode = 128,
193 | zsymScriptCode = 129,
194 | /**
195 | * @deprecated ICU 54. See {@link icu::LayoutEngine}
196 | */
197 |
198 | bamuScriptCode = 130,
199 | lisuScriptCode = 131,
200 | nkgbScriptCode = 132,
201 | sarbScriptCode = 133,
202 | /**
203 | * @deprecated ICU 54. See {@link icu::LayoutEngine}
204 | */
205 |
206 | bassScriptCode = 134,
207 | duplScriptCode = 135,
208 | elbaScriptCode = 136,
209 | granScriptCode = 137,
210 | kpelScriptCode = 138,
211 | lomaScriptCode = 139,
212 | mendScriptCode = 140,
213 | mercScriptCode = 141,
214 | narbScriptCode = 142,
215 | nbatScriptCode = 143,
216 | palmScriptCode = 144,
217 | sindScriptCode = 145,
218 | waraScriptCode = 146,
219 | /**
220 | * @deprecated ICU 54. See {@link icu::LayoutEngine}
221 | */
222 |
223 | afakScriptCode = 147,
224 | jurcScriptCode = 148,
225 | mrooScriptCode = 149,
226 | nshuScriptCode = 150,
227 | shrdScriptCode = 151,
228 | soraScriptCode = 152,
229 | takrScriptCode = 153,
230 | tangScriptCode = 154,
231 | woleScriptCode = 155,
232 | /**
233 | * @deprecated ICU 54. See {@link icu::LayoutEngine}
234 | */
235 |
236 | hluwScriptCode = 156,
237 | khojScriptCode = 157,
238 | tirhScriptCode = 158,
239 | /**
240 | * @deprecated ICU 54. See {@link icu::LayoutEngine}
241 | */
242 |
243 | aghbScriptCode = 159,
244 | mahjScriptCode = 160,
245 | /**
246 | * @deprecated ICU 54. See {@link icu::LayoutEngine}
247 | */
248 |
249 | ahomScriptCode = 161,
250 | hatrScriptCode = 162,
251 | modiScriptCode = 163,
252 | multScriptCode = 164,
253 | paucScriptCode = 165,
254 | siddScriptCode = 166,
255 |
256 | /**
257 | * @deprecated ICU 54. See {@link icu::LayoutEngine}
258 | */
259 | scriptCodeCount
260 | };
261 |
262 | U_NAMESPACE_END
263 | #endif
264 |
--------------------------------------------------------------------------------
/3rd/include/icu/layout/LESwaps.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * (C) Copyright IBM Corp. 1998-2014 - All Rights Reserved
4 | *
5 | */
6 |
7 | #ifndef __LESWAPS_H
8 | #define __LESWAPS_H
9 |
10 | #include "LETypes.h"
11 |
12 | /**
13 | * \file
14 | * \brief C++ API: Endian independent access to data for LayoutEngine
15 | */
16 |
17 | U_NAMESPACE_BEGIN
18 |
19 | /**
20 | * A convenience macro which invokes the swapWord member function
21 | * from a concise call.
22 | *
23 | * @deprecated ICU 54. See {@link icu::LayoutEngine}
24 | */
25 | #define SWAPW(value) LESwaps::swapWord((le_uint16)(value))
26 |
27 | /**
28 | * A convenience macro which invokes the swapLong member function
29 | * from a concise call.
30 | *
31 | * @deprecated ICU 54. See {@link icu::LayoutEngine}
32 | */
33 | #define SWAPL(value) LESwaps::swapLong((le_uint32)(value))
34 |
35 | /**
36 | * This class is used to access data which stored in big endian order
37 | * regardless of the conventions of the platform.
38 | *
39 | * All methods are static and inline in an attempt to induce the compiler
40 | * to do most of the calculations at compile time.
41 | *
42 | * @deprecated ICU 54. See {@link icu::LayoutEngine}
43 | */
44 | class U_LAYOUT_API LESwaps /* not : public UObject because all methods are static */ {
45 | public:
46 |
47 | /**
48 | * Reads a big-endian 16-bit word and returns a native-endian value.
49 | * No-op on a big-endian platform, byte-swaps on a little-endian platform.
50 | *
51 | * @param value - the word to be byte swapped
52 | *
53 | * @return the byte swapped word
54 | *
55 | * @deprecated ICU 54. See {@link icu::LayoutEngine}
56 | */
57 | static le_uint16 swapWord(le_uint16 value)
58 | {
59 | #if (defined(U_IS_BIG_ENDIAN) && U_IS_BIG_ENDIAN) || \
60 | (defined(BYTE_ORDER) && defined(BIG_ENDIAN) && (BYTE_ORDER == BIG_ENDIAN)) || \
61 | defined(__BIG_ENDIAN__)
62 | // Fastpath when we know that the platform is big-endian.
63 | return value;
64 | #else
65 | // Reads a big-endian value on any platform.
66 | const le_uint8 *p = reinterpret_cast68 | * . Base* polymorphic_pointer = createPolymorphicObject(); 69 | * . if (polymorphic_pointer->getDynamicClassID() == 70 | * . erived::getStaticClassID()) ... 71 | *72 | * @return The class ID for all objects of this class. 73 | * @stable ICU 4.0 74 | */ 75 | static UClassID U_EXPORT2 getStaticClassID(void); 76 | 77 | /** 78 | * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This 79 | * method is to implement a simple version of RTTI, since not all C++ 80 | * compilers support genuine RTTI. Polymorphic operator==() and clone() 81 | * methods call this method. 82 | * 83 | * @return The class ID for this object. All objects of a 84 | * given class have the same class ID. Objects of 85 | * other classes have different class IDs. 86 | * @stable ICU 4.0 87 | */ 88 | virtual UClassID getDynamicClassID(void) const; 89 | 90 | 91 | /** 92 | * Copy constructor. 93 | * @stable ICU 4.0 94 | */ 95 | DateInterval(const DateInterval& other); 96 | 97 | /** 98 | * Default assignment operator 99 | * @stable ICU 4.0 100 | */ 101 | DateInterval& operator=(const DateInterval&); 102 | 103 | /** 104 | * Equality operator. 105 | * @return TRUE if the two DateIntervals are the same 106 | * @stable ICU 4.0 107 | */ 108 | virtual UBool operator==(const DateInterval& other) const; 109 | 110 | /** 111 | * Non-equality operator 112 | * @return TRUE if the two DateIntervals are not the same 113 | * @stable ICU 4.0 114 | */ 115 | UBool operator!=(const DateInterval& other) const; 116 | 117 | 118 | /** 119 | * clone this object. 120 | * The caller owns the result and should delete it when done. 121 | * @return a cloned DateInterval 122 | * @stable ICU 4.0 123 | */ 124 | virtual DateInterval* clone() const; 125 | 126 | private: 127 | /** 128 | * Default constructor, not implemented. 129 | */ 130 | DateInterval(); 131 | 132 | UDate fromDate; 133 | UDate toDate; 134 | 135 | } ;// end class DateInterval 136 | 137 | 138 | inline UDate 139 | DateInterval::getFromDate() const { 140 | return fromDate; 141 | } 142 | 143 | 144 | inline UDate 145 | DateInterval::getToDate() const { 146 | return toDate; 147 | } 148 | 149 | 150 | inline UBool 151 | DateInterval::operator!=(const DateInterval& other) const { 152 | return ( !operator==(other) ); 153 | } 154 | 155 | 156 | U_NAMESPACE_END 157 | 158 | #endif 159 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/enumset.h: -------------------------------------------------------------------------------- 1 | /* 2 | ****************************************************************************** 3 | * 4 | * Copyright (C) 2012,2014 International Business Machines 5 | * Corporation and others. All Rights Reserved. 6 | * 7 | ****************************************************************************** 8 | */ 9 | 10 | /** 11 | * \file 12 | * \brief C++: internal template EnumSet<> 13 | */ 14 | 15 | #ifndef ENUMSET_H 16 | #define ENUMSET_H 17 | 18 | #include "unicode/utypes.h" 19 | 20 | #if U_SHOW_CPLUSPLUS_API 21 | 22 | U_NAMESPACE_BEGIN 23 | 24 | /* Can't use #ifndef U_HIDE_INTERNAL_API for the entire EnumSet class, needed in .h file declarations */ 25 | /** 26 | * enum bitset for boolean fields. Similar to Java EnumSet<>. 27 | * Needs to range check. Used for private instance variables. 28 | * @internal 29 | */ 30 | template
78 | * Return true if this FieldPositionIterator is at the same position in an
79 | * equal array of run values.
80 | * @stable ICU 4.4
81 | */
82 | UBool operator==(const FieldPositionIterator&) const;
83 |
84 | /**
85 | * Returns the complement of the result of operator==
86 | * @param rhs The FieldPositionIterator to be compared for inequality
87 | * @return the complement of the result of operator==
88 | * @stable ICU 4.4
89 | */
90 | UBool operator!=(const FieldPositionIterator& rhs) const { return !operator==(rhs); }
91 |
92 | /**
93 | * If the current position is valid, updates the FieldPosition values, advances the iterator,
94 | * and returns TRUE, otherwise returns FALSE.
95 | * @stable ICU 4.4
96 | */
97 | UBool next(FieldPosition& fp);
98 |
99 | private:
100 | friend class FieldPositionIteratorHandler;
101 |
102 | /**
103 | * Sets the data used by the iterator, and resets the position.
104 | * Returns U_ILLEGAL_ARGUMENT_ERROR in status if the data is not valid
105 | * (length is not a multiple of 3, or start >= limit for any run).
106 | */
107 | void setData(UVector32 *adopt, UErrorCode& status);
108 |
109 | UVector32 *data;
110 | int32_t pos;
111 | };
112 |
113 | U_NAMESPACE_END
114 |
115 | #endif /* #if !UCONFIG_NO_FORMATTING */
116 |
117 | #endif // FPOSITER_H
118 |
--------------------------------------------------------------------------------
/3rd/include/icu/unicode/gender.h:
--------------------------------------------------------------------------------
1 | /*
2 | *******************************************************************************
3 | * Copyright (C) 2008-2013, International Business Machines Corporation and
4 | * others. All Rights Reserved.
5 | *******************************************************************************
6 | *
7 | *
8 | * File GENDER.H
9 | *
10 | * Modification History:*
11 | * Date Name Description
12 | *
13 | ********************************************************************************
14 | */
15 |
16 | #ifndef _GENDER
17 | #define _GENDER
18 |
19 | #include "unicode/utypes.h"
20 |
21 | #if !UCONFIG_NO_FORMATTING
22 |
23 | #include "unicode/locid.h"
24 | #include "unicode/ugender.h"
25 | #include "unicode/uobject.h"
26 |
27 | class GenderInfoTest;
28 |
29 | U_NAMESPACE_BEGIN
30 |
31 | // Forward Declaration
32 | void U_CALLCONV GenderInfo_initCache(UErrorCode &status);
33 |
34 | /**
35 | * GenderInfo computes the gender of a list as a whole given the gender of
36 | * each element.
37 | * @stable ICU 50
38 | */
39 | class U_I18N_API GenderInfo : public UObject {
40 | public:
41 |
42 | /**
43 | * Provides access to the predefined GenderInfo object for a given
44 | * locale.
45 | *
46 | * @param locale The locale for which a GenderInfo
object is
47 | * returned.
48 | * @param status Output param set to success/failure code on exit, which
49 | * must not indicate a failure before the function call.
50 | * @return The predefined GenderInfo
object pointer for
51 | * this locale. The returned object is immutable, so it is
52 | * declared as const. Caller does not own the returned
53 | * pointer, so it must not attempt to free it.
54 | * @stable ICU 50
55 | */
56 | static const GenderInfo* U_EXPORT2 getInstance(const Locale& locale, UErrorCode& status);
57 |
58 | /**
59 | * Determines the gender of a list as a whole given the gender of each
60 | * of the elements.
61 | *
62 | * @param genders the gender of each element in the list.
63 | * @param length the length of gender array.
64 | * @param status Output param set to success/failure code on exit, which
65 | * must not indicate a failure before the function call.
66 | * @return the gender of the whole list.
67 | * @stable ICU 50
68 | */
69 | UGender getListGender(const UGender* genders, int32_t length, UErrorCode& status) const;
70 |
71 | /**
72 | * Destructor.
73 | *
74 | * @stable ICU 50
75 | */
76 | virtual ~GenderInfo();
77 |
78 | private:
79 | int32_t _style;
80 |
81 | /**
82 | * Copy constructor. One object per locale invariant. Clients
83 | * must never copy GenderInfo objects.
84 | */
85 | GenderInfo(const GenderInfo& other);
86 |
87 | /**
88 | * Assignment operator. Not applicable to immutable objects.
89 | */
90 | GenderInfo& operator=(const GenderInfo&);
91 |
92 | GenderInfo();
93 |
94 | static const GenderInfo* getNeutralInstance();
95 |
96 | static const GenderInfo* getMixedNeutralInstance();
97 |
98 | static const GenderInfo* getMaleTaintsInstance();
99 |
100 | static const GenderInfo* loadInstance(const Locale& locale, UErrorCode& status);
101 |
102 | friend class ::GenderInfoTest;
103 | friend void U_CALLCONV GenderInfo_initCache(UErrorCode &status);
104 | };
105 |
106 | U_NAMESPACE_END
107 |
108 | #endif /* #if !UCONFIG_NO_FORMATTING */
109 |
110 | #endif // _GENDER
111 | //eof
112 |
--------------------------------------------------------------------------------
/3rd/include/icu/unicode/icudataver.h:
--------------------------------------------------------------------------------
1 | /*
2 | ******************************************************************************
3 | *
4 | * Copyright (C) 2009-2013, International Business Machines
5 | * Corporation and others. All Rights Reserved.
6 | *
7 | ******************************************************************************
8 | */
9 |
10 |
11 | /**
12 | * \file
13 | * \brief C API: access to ICU Data Version number
14 | */
15 |
16 | #ifndef __ICU_DATA_VER_H__
17 | #define __ICU_DATA_VER_H__
18 |
19 | #include "unicode/utypes.h"
20 |
21 | /**
22 | * @stable ICU 49
23 | */
24 | #define U_ICU_VERSION_BUNDLE "icuver"
25 |
26 | /**
27 | * @stable ICU 49
28 | */
29 | #define U_ICU_DATA_KEY "DataVersion"
30 |
31 | /**
32 | * Retrieves the data version from icuver and stores it in dataVersionFillin.
33 | *
34 | * @param dataVersionFillin icuver data version information to be filled in if not-null
35 | * @param status stores the error code from the calls to resource bundle
36 | *
37 | * @stable ICU 49
38 | */
39 | U_STABLE void U_EXPORT2 u_getDataVersion(UVersionInfo dataVersionFillin, UErrorCode *status);
40 |
41 | #endif
42 |
--------------------------------------------------------------------------------
/3rd/include/icu/unicode/listformatter.h:
--------------------------------------------------------------------------------
1 | /*
2 | *******************************************************************************
3 | *
4 | * Copyright (C) 2012-2014, International Business Machines
5 | * Corporation and others. All Rights Reserved.
6 | *
7 | *******************************************************************************
8 | * file name: listformatter.h
9 | * encoding: US-ASCII
10 | * tab size: 8 (not used)
11 | * indentation:4
12 | *
13 | * created on: 20120426
14 | * created by: Umesh P. Nair
15 | */
16 |
17 | #ifndef __LISTFORMATTER_H__
18 | #define __LISTFORMATTER_H__
19 |
20 | #include "unicode/utypes.h"
21 |
22 | #include "unicode/unistr.h"
23 | #include "unicode/locid.h"
24 |
25 | U_NAMESPACE_BEGIN
26 |
27 | /** @internal */
28 | class Hashtable;
29 |
30 | /** @internal */
31 | struct ListFormatInternal;
32 |
33 | /* The following can't be #ifndef U_HIDE_INTERNAL_API, needed for other .h file declarations */
34 | /** @internal */
35 | struct ListFormatData : public UMemory {
36 | UnicodeString twoPattern;
37 | UnicodeString startPattern;
38 | UnicodeString middlePattern;
39 | UnicodeString endPattern;
40 |
41 | ListFormatData(const UnicodeString& two, const UnicodeString& start, const UnicodeString& middle, const UnicodeString& end) :
42 | twoPattern(two), startPattern(start), middlePattern(middle), endPattern(end) {}
43 | };
44 |
45 |
46 | /**
47 | * \file
48 | * \brief C++ API: API for formatting a list.
49 | */
50 |
51 |
52 | /**
53 | * An immutable class for formatting a list, using data from CLDR (or supplied
54 | * separately).
55 | *
56 | * Example: Input data ["Alice", "Bob", "Charlie", "Delta"] will be formatted
57 | * as "Alice, Bob, Charlie and Delta" in English.
58 | *
59 | * The ListFormatter class is not intended for public subclassing.
60 | * @stable ICU 50
61 | */
62 | class U_COMMON_API ListFormatter : public UObject{
63 |
64 | public:
65 |
66 | /**
67 | * Copy constructor.
68 | * @stable ICU 52
69 | */
70 | ListFormatter(const ListFormatter&);
71 |
72 | /**
73 | * Assignment operator.
74 | * @stable ICU 52
75 | */
76 | ListFormatter& operator=(const ListFormatter& other);
77 |
78 | /**
79 | * Creates a ListFormatter appropriate for the default locale.
80 | *
81 | * @param errorCode ICU error code, set if no data available for default locale.
82 | * @return Pointer to a ListFormatter object for the default locale,
83 | * created from internal data derived from CLDR data.
84 | * @stable ICU 50
85 | */
86 | static ListFormatter* createInstance(UErrorCode& errorCode);
87 |
88 | /**
89 | * Creates a ListFormatter appropriate for a locale.
90 | *
91 | * @param locale The locale.
92 | * @param errorCode ICU error code, set if no data available for the given locale.
93 | * @return A ListFormatter object created from internal data derived from
94 | * CLDR data.
95 | * @stable ICU 50
96 | */
97 | static ListFormatter* createInstance(const Locale& locale, UErrorCode& errorCode);
98 |
99 | #ifndef U_HIDE_INTERNAL_API
100 | /**
101 | * Creates a ListFormatter appropriate for a locale and style.
102 | *
103 | * @param locale The locale.
104 | * @param style the style, either "standard", "duration", or "duration-short"
105 | * @param errorCode ICU error code, set if no data available for the given locale.
106 | * @return A ListFormatter object created from internal data derived from
107 | * CLDR data.
108 | * @internal
109 | */
110 | static ListFormatter* createInstance(const Locale& locale, const char* style, UErrorCode& errorCode);
111 | #endif /* U_HIDE_INTERNAL_API */
112 |
113 | /**
114 | * Destructor.
115 | *
116 | * @stable ICU 50
117 | */
118 | virtual ~ListFormatter();
119 |
120 |
121 | /**
122 | * Formats a list of strings.
123 | *
124 | * @param items An array of strings to be combined and formatted.
125 | * @param n_items Length of the array items.
126 | * @param appendTo The string to which the result should be appended to.
127 | * @param errorCode ICU error code, set if there is an error.
128 | * @return Formatted string combining the elements of items, appended to appendTo.
129 | * @stable ICU 50
130 | */
131 | UnicodeString& format(const UnicodeString items[], int32_t n_items,
132 | UnicodeString& appendTo, UErrorCode& errorCode) const;
133 |
134 | #ifndef U_HIDE_INTERNAL_API
135 | /**
136 | @internal for MeasureFormat
137 | */
138 | UnicodeString& format(
139 | const UnicodeString items[],
140 | int32_t n_items,
141 | UnicodeString& appendTo,
142 | int32_t index,
143 | int32_t &offset,
144 | UErrorCode& errorCode) const;
145 | /**
146 | * @internal constructor made public for testing.
147 | */
148 | ListFormatter(const ListFormatData &data);
149 | /**
150 | * @internal constructor made public for testing.
151 | */
152 | ListFormatter(const ListFormatInternal* listFormatterInternal);
153 | #endif /* U_HIDE_INTERNAL_API */
154 |
155 | private:
156 | static void initializeHash(UErrorCode& errorCode);
157 | static const ListFormatInternal* getListFormatInternal(const Locale& locale, const char *style, UErrorCode& errorCode);
158 |
159 | ListFormatter();
160 |
161 | ListFormatInternal* owned;
162 | const ListFormatInternal* data;
163 | };
164 |
165 | U_NAMESPACE_END
166 |
167 | #endif
168 |
--------------------------------------------------------------------------------
/3rd/include/icu/unicode/measure.h:
--------------------------------------------------------------------------------
1 | /*
2 | **********************************************************************
3 | * Copyright (c) 2004-2014, International Business Machines
4 | * Corporation and others. All Rights Reserved.
5 | **********************************************************************
6 | * Author: Alan Liu
7 | * Created: April 26, 2004
8 | * Since: ICU 3.0
9 | **********************************************************************
10 | */
11 | #ifndef __MEASURE_H__
12 | #define __MEASURE_H__
13 |
14 | #include "unicode/utypes.h"
15 |
16 | /**
17 | * \file
18 | * \brief C++ API: MeasureUnit object.
19 | */
20 |
21 | #if !UCONFIG_NO_FORMATTING
22 |
23 | #include "unicode/fmtable.h"
24 |
25 | U_NAMESPACE_BEGIN
26 |
27 | class MeasureUnit;
28 |
29 | /**
30 | * An amount of a specified unit, consisting of a number and a Unit.
31 | * For example, a length measure consists of a number and a length
32 | * unit, such as feet or meters.
33 | *
34 | *
Measure objects are formatted by MeasureFormat. 35 | * 36 | *
Measure objects are immutable. 37 | * 38 | * @author Alan Liu 39 | * @stable ICU 3.0 40 | */ 41 | class U_I18N_API Measure: public UObject { 42 | public: 43 | /** 44 | * Construct an object with the given numeric amount and the given 45 | * unit. After this call, the caller must not delete the given 46 | * unit object. 47 | * @param number a numeric object; amount.isNumeric() must be TRUE 48 | * @param adoptedUnit the unit object, which must not be NULL 49 | * @param ec input-output error code. If the amount or the unit 50 | * is invalid, then this will be set to a failing value. 51 | * @stable ICU 3.0 52 | */ 53 | Measure(const Formattable& number, MeasureUnit* adoptedUnit, 54 | UErrorCode& ec); 55 | 56 | /** 57 | * Copy constructor 58 | * @stable ICU 3.0 59 | */ 60 | Measure(const Measure& other); 61 | 62 | /** 63 | * Assignment operator 64 | * @stable ICU 3.0 65 | */ 66 | Measure& operator=(const Measure& other); 67 | 68 | /** 69 | * Return a polymorphic clone of this object. The result will 70 | * have the same class as returned by getDynamicClassID(). 71 | * @stable ICU 3.0 72 | */ 73 | virtual UObject* clone() const; 74 | 75 | /** 76 | * Destructor 77 | * @stable ICU 3.0 78 | */ 79 | virtual ~Measure(); 80 | 81 | /** 82 | * Equality operator. Return true if this object is equal 83 | * to the given object. 84 | * @stable ICU 3.0 85 | */ 86 | UBool operator==(const UObject& other) const; 87 | 88 | /** 89 | * Return a reference to the numeric value of this object. The 90 | * numeric value may be of any numeric type supported by 91 | * Formattable. 92 | * @stable ICU 3.0 93 | */ 94 | inline const Formattable& getNumber() const; 95 | 96 | /** 97 | * Return a reference to the unit of this object. 98 | * @stable ICU 3.0 99 | */ 100 | inline const MeasureUnit& getUnit() const; 101 | 102 | /** 103 | * Return the class ID for this class. This is useful only for comparing to 104 | * a return value from getDynamicClassID(). For example: 105 | *
106 | * . Base* polymorphic_pointer = createPolymorphicObject(); 107 | * . if (polymorphic_pointer->getDynamicClassID() == 108 | * . erived::getStaticClassID()) ... 109 | *110 | * @return The class ID for all objects of this class. 111 | * @draft ICU 53 112 | */ 113 | static UClassID U_EXPORT2 getStaticClassID(void); 114 | 115 | /** 116 | * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This 117 | * method is to implement a simple version of RTTI, since not all C++ 118 | * compilers support genuine RTTI. Polymorphic operator==() and clone() 119 | * methods call this method. 120 | * 121 | * @return The class ID for this object. All objects of a 122 | * given class have the same class ID. Objects of 123 | * other classes have different class IDs. 124 | * @draft ICU 53 125 | */ 126 | virtual UClassID getDynamicClassID(void) const; 127 | 128 | protected: 129 | /** 130 | * Default constructor. 131 | * @stable ICU 3.0 132 | */ 133 | Measure(); 134 | 135 | private: 136 | /** 137 | * The numeric value of this object, e.g. 2.54 or 100. 138 | */ 139 | Formattable number; 140 | 141 | /** 142 | * The unit of this object, e.g., "millimeter" or "JPY". This is 143 | * owned by this object. 144 | */ 145 | MeasureUnit* unit; 146 | }; 147 | 148 | inline const Formattable& Measure::getNumber() const { 149 | return number; 150 | } 151 | 152 | inline const MeasureUnit& Measure::getUnit() const { 153 | return *unit; 154 | } 155 | 156 | U_NAMESPACE_END 157 | 158 | #endif // !UCONFIG_NO_FORMATTING 159 | #endif // __MEASURE_H__ 160 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/parseerr.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (C) 1999-2005, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ********************************************************************** 6 | * Date Name Description 7 | * 03/14/00 aliu Creation. 8 | * 06/27/00 aliu Change from C++ class to C struct 9 | ********************************************************************** 10 | */ 11 | #ifndef PARSEERR_H 12 | #define PARSEERR_H 13 | 14 | #include "unicode/utypes.h" 15 | 16 | 17 | /** 18 | * \file 19 | * \brief C API: Parse Error Information 20 | */ 21 | /** 22 | * The capacity of the context strings in UParseError. 23 | * @stable ICU 2.0 24 | */ 25 | enum { U_PARSE_CONTEXT_LEN = 16 }; 26 | 27 | /** 28 | * A UParseError struct is used to returned detailed information about 29 | * parsing errors. It is used by ICU parsing engines that parse long 30 | * rules, patterns, or programs, where the text being parsed is long 31 | * enough that more information than a UErrorCode is needed to 32 | * localize the error. 33 | * 34 | *
The line, offset, and context fields are optional; parsing 35 | * engines may choose not to use to use them. 36 | * 37 | *
The preContext and postContext strings include some part of the 38 | * context surrounding the error. If the source text is "let for=7" 39 | * and "for" is the error (e.g., because it is a reserved word), then 40 | * some examples of what a parser might produce are the following: 41 | * 42 | *
43 | * preContext postContext 44 | * "" "" The parser does not support context 45 | * "let " "=7" Pre- and post-context only 46 | * "let " "for=7" Pre- and post-context and error text 47 | * "" "for" Error text only 48 | *49 | * 50 | *
Examples of engines which use UParseError (or may use it in the
51 | * future) are Transliterator, RuleBasedBreakIterator, and
52 | * RegexPattern.
53 | *
54 | * @stable ICU 2.0
55 | */
56 | typedef struct UParseError {
57 |
58 | /**
59 | * The line on which the error occured. If the parser uses this
60 | * field, it sets it to the line number of the source text line on
61 | * which the error appears, which will be be a value >= 1. If the
62 | * parse does not support line numbers, the value will be <= 0.
63 | * @stable ICU 2.0
64 | */
65 | int32_t line;
66 |
67 | /**
68 | * The character offset to the error. If the line field is >= 1,
69 | * then this is the offset from the start of the line. Otherwise,
70 | * this is the offset from the start of the text. If the parser
71 | * does not support this field, it will have a value < 0.
72 | * @stable ICU 2.0
73 | */
74 | int32_t offset;
75 |
76 | /**
77 | * Textual context before the error. Null-terminated. The empty
78 | * string if not supported by parser.
79 | * @stable ICU 2.0
80 | */
81 | UChar preContext[U_PARSE_CONTEXT_LEN];
82 |
83 | /**
84 | * The error itself and/or textual context after the error.
85 | * Null-terminated. The empty string if not supported by parser.
86 | * @stable ICU 2.0
87 | */
88 | UChar postContext[U_PARSE_CONTEXT_LEN];
89 |
90 | } UParseError;
91 |
92 | #endif
93 |
--------------------------------------------------------------------------------
/3rd/include/icu/unicode/parsepos.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 1997-2005, International Business Machines Corporation and others. All Rights Reserved.
3 | *******************************************************************************
4 | *
5 | * File PARSEPOS.H
6 | *
7 | * Modification History:
8 | *
9 | * Date Name Description
10 | * 07/09/97 helena Converted from java.
11 | * 07/17/98 stephen Added errorIndex support.
12 | * 05/11/99 stephen Cleaned up.
13 | *******************************************************************************
14 | */
15 |
16 | #ifndef PARSEPOS_H
17 | #define PARSEPOS_H
18 |
19 | #include "unicode/utypes.h"
20 | #include "unicode/uobject.h"
21 |
22 |
23 | U_NAMESPACE_BEGIN
24 |
25 | /**
26 | * \file
27 | * \brief C++ API: Canonical Iterator
28 | */
29 | /**
30 | * ParsePosition
is a simple class used by Format
31 | * and its subclasses to keep track of the current position during parsing.
32 | * The parseObject
method in the various Format
33 | * classes requires a ParsePosition
object as an argument.
34 | *
35 | *
36 | * By design, as you parse through a string with different formats,
37 | * you can use the same A symbol table maintains two kinds of mappings. The first is
34 | * between symbolic names and their values. For example, if the
35 | * variable with the name "start" is set to the value "alpha"
36 | * (perhaps, though not necessarily, through an expression such as
37 | * "$start=alpha"), then the call lookup("start") will return the
38 | * char[] array ['a', 'l', 'p', 'h', 'a'].
39 | *
40 | * The second kind of mapping is between character values and
41 | * UnicodeMatcher objects. This is used by RuleBasedTransliterator,
42 | * which uses characters in the private use area to represent objects
43 | * such as UnicodeSets. If U+E015 is mapped to the UnicodeSet [a-z],
44 | * then lookupMatcher(0xE015) will return the UnicodeSet [a-z].
45 | *
46 | * Finally, a symbol table defines parsing behavior for symbolic
47 | * names. All symbolic names start with the SYMBOL_REF character.
48 | * When a parser encounters this character, it calls parseReference()
49 | * with the position immediately following the SYMBOL_REF. The symbol
50 | * table parses the name, if there is one, and returns it.
51 | *
52 | * @stable ICU 2.8
53 | */
54 | class U_COMMON_API SymbolTable /* not : public UObject because this is an interface/mixin class */ {
55 | public:
56 |
57 | /**
58 | * The character preceding a symbol reference name.
59 | * @stable ICU 2.8
60 | */
61 | enum { SYMBOL_REF = 0x0024 /*$*/ };
62 |
63 | /**
64 | * Destructor.
65 | * @stable ICU 2.8
66 | */
67 | virtual ~SymbolTable();
68 |
69 | /**
70 | * Lookup the characters associated with this string and return it.
71 | * Return NULL if no such name exists. The resultant
72 | * string may have length zero.
73 | * @param s the symbolic name to lookup
74 | * @return a string containing the name's value, or NULL if
75 | * there is no mapping for s.
76 | * @stable ICU 2.8
77 | */
78 | virtual const UnicodeString* lookup(const UnicodeString& s) const = 0;
79 |
80 | /**
81 | * Lookup the UnicodeMatcher associated with the given character, and
82 | * return it. Return NULL if not found.
83 | * @param ch a 32-bit code point from 0 to 0x10FFFF inclusive.
84 | * @return the UnicodeMatcher object represented by the given
85 | * character, or NULL if there is no mapping for ch.
86 | * @stable ICU 2.8
87 | */
88 | virtual const UnicodeFunctor* lookupMatcher(UChar32 ch) const = 0;
89 |
90 | /**
91 | * Parse a symbol reference name from the given string, starting
92 | * at the given position. If no valid symbol reference name is
93 | * found, return the empty string and leave pos unchanged. That is, if the
94 | * character at pos cannot start a name, or if pos is at or after
95 | * text.length(), then return an empty string. This indicates an
96 | * isolated SYMBOL_REF character.
97 | * @param text the text to parse for the name
98 | * @param pos on entry, the index of the first character to parse.
99 | * This is the character following the SYMBOL_REF character. On
100 | * exit, the index after the last parsed character. If the parse
101 | * failed, pos is unchanged on exit.
102 | * @param limit the index after the last character to be parsed.
103 | * @return the parsed name, or an empty string if there is no
104 | * valid symbolic name at the given position.
105 | * @stable ICU 2.8
106 | */
107 | virtual UnicodeString parseReference(const UnicodeString& text,
108 | ParsePosition& pos, int32_t limit) const = 0;
109 | };
110 | U_NAMESPACE_END
111 |
112 | #endif
113 |
--------------------------------------------------------------------------------
/3rd/include/icu/unicode/tmunit.h:
--------------------------------------------------------------------------------
1 | /*
2 | *******************************************************************************
3 | * Copyright (C) 2009-2014, Google, International Business Machines Corporation and *
4 | * others. All Rights Reserved. *
5 | *******************************************************************************
6 | */
7 |
8 | #ifndef __TMUNIT_H__
9 | #define __TMUNIT_H__
10 |
11 |
12 | /**
13 | * \file
14 | * \brief C++ API: time unit object
15 | */
16 |
17 |
18 | #include "unicode/measunit.h"
19 |
20 | #if !UCONFIG_NO_FORMATTING
21 |
22 | U_NAMESPACE_BEGIN
23 |
24 | /**
25 | * Measurement unit for time units.
26 | * @see TimeUnitAmount
27 | * @see TimeUnit
28 | * @stable ICU 4.2
29 | */
30 | class U_I18N_API TimeUnit: public MeasureUnit {
31 | public:
32 | /**
33 | * Constants for all the time units we supported.
34 | * @stable ICU 4.2
35 | */
36 | enum UTimeUnitFields {
37 | UTIMEUNIT_YEAR,
38 | UTIMEUNIT_MONTH,
39 | UTIMEUNIT_DAY,
40 | UTIMEUNIT_WEEK,
41 | UTIMEUNIT_HOUR,
42 | UTIMEUNIT_MINUTE,
43 | UTIMEUNIT_SECOND,
44 | UTIMEUNIT_FIELD_COUNT
45 | };
46 |
47 | /**
48 | * Create Instance.
49 | * @param timeUnitField time unit field based on which the instance
50 | * is created.
51 | * @param status input-output error code.
52 | * If the timeUnitField is invalid,
53 | * then this will be set to U_ILLEGAL_ARGUMENT_ERROR.
54 | * @return a TimeUnit instance
55 | * @stable ICU 4.2
56 | */
57 | static TimeUnit* U_EXPORT2 createInstance(UTimeUnitFields timeUnitField,
58 | UErrorCode& status);
59 |
60 |
61 | /**
62 | * Override clone.
63 | * @stable ICU 4.2
64 | */
65 | virtual UObject* clone() const;
66 |
67 | /**
68 | * Copy operator.
69 | * @stable ICU 4.2
70 | */
71 | TimeUnit(const TimeUnit& other);
72 |
73 | /**
74 | * Assignment operator.
75 | * @stable ICU 4.2
76 | */
77 | TimeUnit& operator=(const TimeUnit& other);
78 |
79 | /**
80 | * Returns a unique class ID for this object POLYMORPHICALLY.
81 | * This method implements a simple form of RTTI used by ICU.
82 | * @return The class ID for this object. All objects of a given
83 | * class have the same class ID. Objects of other classes have
84 | * different class IDs.
85 | * @stable ICU 4.2
86 | */
87 | virtual UClassID getDynamicClassID() const;
88 |
89 | /**
90 | * Returns the class ID for this class. This is used to compare to
91 | * the return value of getDynamicClassID().
92 | * @return The class ID for all objects of this class.
93 | * @stable ICU 4.2
94 | */
95 | static UClassID U_EXPORT2 getStaticClassID();
96 |
97 |
98 | /**
99 | * Get time unit field.
100 | * @return time unit field.
101 | * @stable ICU 4.2
102 | */
103 | UTimeUnitFields getTimeUnitField() const;
104 |
105 | /**
106 | * Destructor.
107 | * @stable ICU 4.2
108 | */
109 | virtual ~TimeUnit();
110 |
111 | private:
112 | UTimeUnitFields fTimeUnitField;
113 |
114 | /**
115 | * Constructor
116 | * @internal ICU 4.2
117 | */
118 | TimeUnit(UTimeUnitFields timeUnitField);
119 |
120 | };
121 |
122 |
123 | U_NAMESPACE_END
124 |
125 | #endif /* #if !UCONFIG_NO_FORMATTING */
126 |
127 | #endif // __TMUNIT_H__
128 | //eof
129 | //
130 |
--------------------------------------------------------------------------------
/3rd/include/icu/unicode/tmutamt.h:
--------------------------------------------------------------------------------
1 | /*
2 | *******************************************************************************
3 | * Copyright (C) 2009-2010, Google, International Business Machines Corporation and *
4 | * others. All Rights Reserved. *
5 | *******************************************************************************
6 | */
7 |
8 | #ifndef __TMUTAMT_H__
9 | #define __TMUTAMT_H__
10 |
11 |
12 | /**
13 | * \file
14 | * \brief C++ API: time unit amount object.
15 | */
16 |
17 | #include "unicode/measure.h"
18 | #include "unicode/tmunit.h"
19 |
20 | #if !UCONFIG_NO_FORMATTING
21 |
22 | U_NAMESPACE_BEGIN
23 |
24 |
25 | /**
26 | * Express a duration as a time unit and number. Patterned after Currency.
27 | * @see TimeUnitAmount
28 | * @see TimeUnitFormat
29 | * @stable ICU 4.2
30 | */
31 | class U_I18N_API TimeUnitAmount: public Measure {
32 | public:
33 | /**
34 | * Construct TimeUnitAmount object with the given number and the
35 | * given time unit.
36 | * @param number a numeric object; number.isNumeric() must be TRUE
37 | * @param timeUnitField the time unit field of a time unit
38 | * @param status the input-output error code.
39 | * If the number is not numeric or the timeUnitField
40 | * is not valid,
41 | * then this will be set to a failing value:
42 | * U_ILLEGAL_ARGUMENT_ERROR.
43 | * @stable ICU 4.2
44 | */
45 | TimeUnitAmount(const Formattable& number,
46 | TimeUnit::UTimeUnitFields timeUnitField,
47 | UErrorCode& status);
48 |
49 | /**
50 | * Construct TimeUnitAmount object with the given numeric amount and the
51 | * given time unit.
52 | * @param amount a numeric amount.
53 | * @param timeUnitField the time unit field on which a time unit amount
54 | * object will be created.
55 | * @param status the input-output error code.
56 | * If the timeUnitField is not valid,
57 | * then this will be set to a failing value:
58 | * U_ILLEGAL_ARGUMENT_ERROR.
59 | * @stable ICU 4.2
60 | */
61 | TimeUnitAmount(double amount, TimeUnit::UTimeUnitFields timeUnitField,
62 | UErrorCode& status);
63 |
64 |
65 | /**
66 | * Copy constructor
67 | * @stable ICU 4.2
68 | */
69 | TimeUnitAmount(const TimeUnitAmount& other);
70 |
71 |
72 | /**
73 | * Assignment operator
74 | * @stable ICU 4.2
75 | */
76 | TimeUnitAmount& operator=(const TimeUnitAmount& other);
77 |
78 |
79 | /**
80 | * Clone.
81 | * @return a polymorphic clone of this object. The result will have the same class as returned by getDynamicClassID().
82 | * @stable ICU 4.2
83 | */
84 | virtual UObject* clone() const;
85 |
86 |
87 | /**
88 | * Destructor
89 | * @stable ICU 4.2
90 | */
91 | virtual ~TimeUnitAmount();
92 |
93 |
94 | /**
95 | * Equality operator.
96 | * @param other the object to compare to.
97 | * @return true if this object is equal to the given object.
98 | * @stable ICU 4.2
99 | */
100 | virtual UBool operator==(const UObject& other) const;
101 |
102 |
103 | /**
104 | * Not-equality operator.
105 | * @param other the object to compare to.
106 | * @return true if this object is not equal to the given object.
107 | * @stable ICU 4.2
108 | */
109 | UBool operator!=(const UObject& other) const;
110 |
111 |
112 | /**
113 | * Return the class ID for this class. This is useful only for comparing to
114 | * a return value from getDynamicClassID(). For example:
115 | * Note: UnicodeFilter currently stubs out two pure virtual methods
42 | * of its base class, UnicodeMatcher. These methods are toPattern()
43 | * and matchesIndexValue(). This is done so that filter classes that
44 | * are not actually used as matchers -- specifically, those in the
45 | * UnicodeFilterLogic component, and those in tests -- can continue to
46 | * work without defining these methods. As long as a filter is not
47 | * used in an RBT during real transliteration, these methods will not
48 | * be called. However, this breaks the UnicodeMatcher base class
49 | * protocol, and it is not a correct solution.
50 | *
51 | * In the future we may revisit the UnicodeMatcher / UnicodeFilter
52 | * hierarchy and either redesign it, or simply remove the stubs in
53 | * UnicodeFilter and force subclasses to implement the full
54 | * UnicodeMatcher protocol.
55 | *
56 | * @see UnicodeFilterLogic
57 | * @stable ICU 2.0
58 | */
59 | class U_COMMON_API UnicodeFilter : public UnicodeFunctor, public UnicodeMatcher {
60 |
61 | public:
62 | /**
63 | * Destructor
64 | * @stable ICU 2.0
65 | */
66 | virtual ~UnicodeFilter();
67 |
68 | /**
69 | * Returns true for characters that are in the selected
70 | * subset. In other words, if a character is to be
71 | * filtered, then contains() returns
72 | * false.
73 | * @stable ICU 2.0
74 | */
75 | virtual UBool contains(UChar32 c) const = 0;
76 |
77 | /**
78 | * UnicodeFunctor API. Cast 'this' to a UnicodeMatcher* pointer
79 | * and return the pointer.
80 | * @stable ICU 2.4
81 | */
82 | virtual UnicodeMatcher* toMatcher() const;
83 |
84 | /**
85 | * Implement UnicodeMatcher API.
86 | * @stable ICU 2.4
87 | */
88 | virtual UMatchDegree matches(const Replaceable& text,
89 | int32_t& offset,
90 | int32_t limit,
91 | UBool incremental);
92 |
93 | /**
94 | * UnicodeFunctor API. Nothing to do.
95 | * @stable ICU 2.4
96 | */
97 | virtual void setData(const TransliterationRuleData*);
98 |
99 | /**
100 | * ICU "poor man's RTTI", returns a UClassID for this class.
101 | *
102 | * @stable ICU 2.2
103 | */
104 | static UClassID U_EXPORT2 getStaticClassID();
105 |
106 | protected:
107 |
108 | /*
109 | * Since this class has pure virtual functions,
110 | * a constructor can't be used.
111 | * @stable ICU 2.0
112 | */
113 | /* UnicodeFilter();*/
114 | };
115 |
116 | /*inline UnicodeFilter::UnicodeFilter() {}*/
117 |
118 | U_NAMESPACE_END
119 |
120 | #endif
121 |
--------------------------------------------------------------------------------
/3rd/include/icu/unicode/unifunct.h:
--------------------------------------------------------------------------------
1 | /*
2 | **********************************************************************
3 | * Copyright (c) 2002-2005, International Business Machines Corporation
4 | * and others. All Rights Reserved.
5 | **********************************************************************
6 | * Date Name Description
7 | * 01/14/2002 aliu Creation.
8 | **********************************************************************
9 | */
10 | #ifndef UNIFUNCT_H
11 | #define UNIFUNCT_H
12 |
13 | #include "unicode/utypes.h"
14 | #include "unicode/uobject.h"
15 |
16 | /**
17 | * \file
18 | * \brief C++ API: Unicode Functor
19 | */
20 |
21 | U_NAMESPACE_BEGIN
22 |
23 | class UnicodeMatcher;
24 | class UnicodeReplacer;
25 | class TransliterationRuleData;
26 |
27 | /**
28 | * Concrete subclasses of UnicodeFunctor should use the macro
90 | * UOBJECT_DEFINE_RTTI_IMPLEMENTATION from uobject.h to
91 | * provide definitios getStaticClassID and getDynamicClassID.
92 | *
93 | * @return The class ID for this object. All objects of a given
94 | * class have the same class ID. Objects of other classes have
95 | * different class IDs.
96 | * @stable ICU 2.4
97 | */
98 | virtual UClassID getDynamicClassID(void) const = 0;
99 |
100 | /**
101 | * Set the data object associated with this functor. The data
102 | * object provides context for functor-to-standin mapping. This
103 | * method is required when assigning a functor to a different data
104 | * object. This function MAY GO AWAY later if the architecture is
105 | * changed to pass data object pointers through the API.
106 | * @internal ICU 2.1
107 | */
108 | virtual void setData(const TransliterationRuleData*) = 0;
109 |
110 | protected:
111 |
112 | /**
113 | * Since this class has pure virtual functions,
114 | * a constructor can't be used.
115 | * @stable ICU 2.0
116 | */
117 | /*UnicodeFunctor();*/
118 |
119 | };
120 |
121 | /*inline UnicodeFunctor::UnicodeFunctor() {}*/
122 |
123 | U_NAMESPACE_END
124 |
125 | #endif
126 |
--------------------------------------------------------------------------------
/3rd/include/icu/unicode/unimatch.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2001-2005, International Business Machines Corporation and others. All Rights Reserved.
3 | **********************************************************************
4 | * Date Name Description
5 | * 07/18/01 aliu Creation.
6 | **********************************************************************
7 | */
8 | #ifndef UNIMATCH_H
9 | #define UNIMATCH_H
10 |
11 | #include "unicode/utypes.h"
12 |
13 | /**
14 | * \file
15 | * \brief C++ API: Unicode Matcher
16 | */
17 |
18 |
19 | U_NAMESPACE_BEGIN
20 |
21 | class Replaceable;
22 | class UnicodeString;
23 | class UnicodeSet;
24 |
25 | /**
26 | * Constants returned by Note: This method is not const because some classes may
100 | * modify their state as the result of a match.
101 | *
102 | * @param text the text to be matched
103 | * @param offset on input, the index into text at which to begin
104 | * matching. On output, the limit of the matched text. The
105 | * number of matched characters is the output value of offset
106 | * minus the input value. Offset should always point to the
107 | * HIGH SURROGATE (leading code unit) of a pair of surrogates,
108 | * both on entry and upon return.
109 | * @param limit the limit index of text to be matched. Greater
110 | * than offset for a forward direction match, less than offset for
111 | * a backward direction match. The last character to be
112 | * considered for matching will be text.charAt(limit-1) in the
113 | * forward direction or text.charAt(limit+1) in the backward
114 | * direction.
115 | * @param incremental if TRUE, then assume further characters may
116 | * be inserted at limit and check for partial matching. Otherwise
117 | * assume the text as given is complete.
118 | * @return a match degree value indicating a full match, a partial
119 | * match, or a mismatch. If incremental is FALSE then
120 | * U_PARTIAL_MATCH should never be returned.
121 | * @stable ICU 2.4
122 | */
123 | virtual UMatchDegree matches(const Replaceable& text,
124 | int32_t& offset,
125 | int32_t limit,
126 | UBool incremental) = 0;
127 |
128 | /**
129 | * Returns a string representation of this matcher. If the result of
130 | * calling this function is passed to the appropriate parser, it
131 | * will produce another matcher that is equal to this one.
132 | * @param result the string to receive the pattern. Previous
133 | * contents will be deleted.
134 | * @param escapeUnprintable if TRUE then convert unprintable
135 | * character to their hex escape representations, \\uxxxx or
136 | * \\Uxxxxxxxx. Unprintable characters are those other than
137 | * U+000A, U+0020..U+007E.
138 | * @stable ICU 2.4
139 | */
140 | virtual UnicodeString& toPattern(UnicodeString& result,
141 | UBool escapeUnprintable = FALSE) const = 0;
142 |
143 | /**
144 | * Returns TRUE if this matcher will match a character c, where c
145 | * & 0xFF == v, at offset, in the forward direction (with limit >
146 | * offset). This is used by RuleBasedTransliterator for
147 | * indexing.
148 | * @stable ICU 2.4
149 | */
150 | virtual UBool matchesIndexValue(uint8_t v) const = 0;
151 |
152 | /**
153 | * Union the set of all characters that may be matched by this object
154 | * into the given set.
155 | * @param toUnionTo the set into which to union the source characters
156 | * @stable ICU 2.4
157 | */
158 | virtual void addMatchSetTo(UnicodeSet& toUnionTo) const = 0;
159 | };
160 |
161 | U_NAMESPACE_END
162 |
163 | #endif
164 |
--------------------------------------------------------------------------------
/3rd/include/icu/unicode/unirepl.h:
--------------------------------------------------------------------------------
1 | /*
2 | **********************************************************************
3 | * Copyright (c) 2002-2005, International Business Machines Corporation
4 | * and others. All Rights Reserved.
5 | **********************************************************************
6 | * Date Name Description
7 | * 01/14/2002 aliu Creation.
8 | **********************************************************************
9 | */
10 | #ifndef UNIREPL_H
11 | #define UNIREPL_H
12 |
13 | #include "unicode/utypes.h"
14 |
15 | /**
16 | * \file
17 | * \brief C++ API: UnicodeReplacer
18 | */
19 |
20 | U_NAMESPACE_BEGIN
21 |
22 | class Replaceable;
23 | class UnicodeString;
24 | class UnicodeSet;
25 |
26 | /**
27 | * This is a mixin class.
33 | * @author Alan Liu
34 | * @stable ICU 2.4
35 | */
36 | class U_I18N_API UnicodeReplacer /* not : public UObject because this is an interface/mixin class */ {
37 |
38 | public:
39 |
40 | /**
41 | * Destructor.
42 | * @stable ICU 2.4
43 | */
44 | virtual ~UnicodeReplacer();
45 |
46 | /**
47 | * Replace characters in 'text' from 'start' to 'limit' with the
48 | * output text of this object. Update the 'cursor' parameter to
49 | * give the cursor position and return the length of the
50 | * replacement text.
51 | *
52 | * @param text the text to be matched
53 | * @param start inclusive start index of text to be replaced
54 | * @param limit exclusive end index of text to be replaced;
55 | * must be greater than or equal to start
56 | * @param cursor output parameter for the cursor position.
57 | * Not all replacer objects will update this, but in a complete
58 | * tree of replacer objects, representing the entire output side
59 | * of a transliteration rule, at least one must update it.
60 | * @return the number of 16-bit code units in the text replacing
61 | * the characters at offsets start..(limit-1) in text
62 | * @stable ICU 2.4
63 | */
64 | virtual int32_t replace(Replaceable& text,
65 | int32_t start,
66 | int32_t limit,
67 | int32_t& cursor) = 0;
68 |
69 | /**
70 | * Returns a string representation of this replacer. If the
71 | * result of calling this function is passed to the appropriate
72 | * parser, typically TransliteratorParser, it will produce another
73 | * replacer that is equal to this one.
74 | * @param result the string to receive the pattern. Previous
75 | * contents will be deleted.
76 | * @param escapeUnprintable if TRUE then convert unprintable
77 | * character to their hex escape representations, \\uxxxx or
78 | * \\Uxxxxxxxx. Unprintable characters are defined by
79 | * Utility.isUnprintable().
80 | * @return a reference to 'result'.
81 | * @stable ICU 2.4
82 | */
83 | virtual UnicodeString& toReplacerPattern(UnicodeString& result,
84 | UBool escapeUnprintable) const = 0;
85 |
86 | /**
87 | * Union the set of all characters that may output by this object
88 | * into the given set.
89 | * @param toUnionTo the set into which to union the output characters
90 | * @stable ICU 2.4
91 | */
92 | virtual void addReplacementSetTo(UnicodeSet& toUnionTo) const = 0;
93 | };
94 |
95 | U_NAMESPACE_END
96 |
97 | #endif
98 |
--------------------------------------------------------------------------------
/3rd/include/icu/unicode/upluralrules.h:
--------------------------------------------------------------------------------
1 | /*
2 | *****************************************************************************************
3 | * Copyright (C) 2010-2013, International Business Machines
4 | * Corporation and others. All Rights Reserved.
5 | *****************************************************************************************
6 | */
7 |
8 | #ifndef UPLURALRULES_H
9 | #define UPLURALRULES_H
10 |
11 | #include "unicode/utypes.h"
12 |
13 | #if !UCONFIG_NO_FORMATTING
14 |
15 | #include "unicode/localpointer.h"
16 |
17 | /**
18 | * \file
19 | * \brief C API: Plural rules, select plural keywords for numeric values.
20 | *
21 | * A UPluralRules object defines rules for mapping non-negative numeric
22 | * values onto a small set of keywords. Rules are constructed from a text
23 | * description, consisting of a series of keywords and conditions.
24 | * The uplrules_select function examines each condition in order and
25 | * returns the keyword for the first condition that matches the number.
26 | * If none match, the default rule(other) is returned.
27 | *
28 | * For more information, see the LDML spec, C.11 Language Plural Rules:
29 | * http://www.unicode.org/reports/tr35/#Language_Plural_Rules
30 | *
31 | * Keywords: ICU locale data has 6 predefined values -
32 | * 'zero', 'one', 'two', 'few', 'many' and 'other'. Callers need to check
33 | * the value of keyword returned by the uplrules_select function.
34 | *
35 | * These are based on CLDR Language Plural Rules. For these
36 | * predefined rules, see the CLDR page at
37 | * http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
38 | */
39 |
40 | /**
41 | * Type of plurals and PluralRules.
42 | * @stable ICU 50
43 | */
44 | enum UPluralType {
45 | /**
46 | * Plural rules for cardinal numbers: 1 file vs. 2 files.
47 | * @stable ICU 50
48 | */
49 | UPLURAL_TYPE_CARDINAL,
50 | /**
51 | * Plural rules for ordinal numbers: 1st file, 2nd file, 3rd file, 4th file, etc.
52 | * @stable ICU 50
53 | */
54 | UPLURAL_TYPE_ORDINAL,
55 | /**
56 | * Number of Plural rules types.
57 | * @stable ICU 50
58 | */
59 | UPLURAL_TYPE_COUNT
60 | };
61 | /**
62 | * @stable ICU 50
63 | */
64 | typedef enum UPluralType UPluralType;
65 |
66 | /**
67 | * Opaque UPluralRules object for use in C programs.
68 | * @stable ICU 4.8
69 | */
70 | struct UPluralRules;
71 | typedef struct UPluralRules UPluralRules; /**< C typedef for struct UPluralRules. @stable ICU 4.8 */
72 |
73 | /**
74 | * Opens a new UPluralRules object using the predefined cardinal-number plural rules for a
75 | * given locale.
76 | * Same as uplrules_openForType(locale, UPLURAL_TYPE_CARDINAL, status).
77 | * @param locale The locale for which the rules are desired.
78 | * @param status A pointer to a UErrorCode to receive any errors.
79 | * @return A UPluralRules for the specified locale, or NULL if an error occurred.
80 | * @stable ICU 4.8
81 | */
82 | U_STABLE UPluralRules* U_EXPORT2
83 | uplrules_open(const char *locale, UErrorCode *status);
84 |
85 | /**
86 | * Opens a new UPluralRules object using the predefined plural rules for a
87 | * given locale and the plural type.
88 | * @param locale The locale for which the rules are desired.
89 | * @param type The plural type (e.g., cardinal or ordinal).
90 | * @param status A pointer to a UErrorCode to receive any errors.
91 | * @return A UPluralRules for the specified locale, or NULL if an error occurred.
92 | * @stable ICU 50
93 | */
94 | U_DRAFT UPluralRules* U_EXPORT2
95 | uplrules_openForType(const char *locale, UPluralType type, UErrorCode *status);
96 |
97 | /**
98 | * Closes a UPluralRules object. Once closed it may no longer be used.
99 | * @param uplrules The UPluralRules object to close.
100 | * @stable ICU 4.8
101 | */
102 | U_STABLE void U_EXPORT2
103 | uplrules_close(UPluralRules *uplrules);
104 |
105 |
106 | #if U_SHOW_CPLUSPLUS_API
107 |
108 | U_NAMESPACE_BEGIN
109 |
110 | /**
111 | * \class LocalUPluralRulesPointer
112 | * "Smart pointer" class, closes a UPluralRules via uplrules_close().
113 | * For most methods see the LocalPointerBase base class.
114 | *
115 | * @see LocalPointerBase
116 | * @see LocalPointer
117 | * @stable ICU 4.8
118 | */
119 | U_DEFINE_LOCAL_OPEN_POINTER(LocalUPluralRulesPointer, UPluralRules, uplrules_close);
120 |
121 | U_NAMESPACE_END
122 |
123 | #endif
124 |
125 |
126 | /**
127 | * Given a number, returns the keyword of the first rule that
128 | * applies to the number, according to the supplied UPluralRules object.
129 | * @param uplrules The UPluralRules object specifying the rules.
130 | * @param number The number for which the rule has to be determined.
131 | * @param keyword The keyword of the rule that applies to number.
132 | * @param capacity The capacity of keyword.
133 | * @param status A pointer to a UErrorCode to receive any errors.
134 | * @return The length of keyword.
135 | * @stable ICU 4.8
136 | */
137 | U_STABLE int32_t U_EXPORT2
138 | uplrules_select(const UPluralRules *uplrules,
139 | double number,
140 | UChar *keyword, int32_t capacity,
141 | UErrorCode *status);
142 |
143 | #endif /* #if !UCONFIG_NO_FORMATTING */
144 |
145 | #endif
146 |
--------------------------------------------------------------------------------
/3rd/include/icu/unicode/urep.h:
--------------------------------------------------------------------------------
1 | /*
2 | ******************************************************************************
3 | * Copyright (C) 1997-2010, International Business Machines
4 | * Corporation and others. All Rights Reserved.
5 | ******************************************************************************
6 | * Date Name Description
7 | * 06/23/00 aliu Creation.
8 | ******************************************************************************
9 | */
10 |
11 | #ifndef __UREP_H
12 | #define __UREP_H
13 |
14 | #include "unicode/utypes.h"
15 |
16 | U_CDECL_BEGIN
17 |
18 | /********************************************************************
19 | * General Notes
20 | ********************************************************************
21 | * TODO
22 | * Add usage scenario
23 | * Add test code
24 | * Talk about pinning
25 | * Talk about "can truncate result if out of memory"
26 | */
27 |
28 | /********************************************************************
29 | * Data Structures
30 | ********************************************************************/
31 | /**
32 | * \file
33 | * \brief C API: Callbacks for UReplaceable
34 | */
35 | /**
36 | * An opaque replaceable text object. This will be manipulated only
37 | * through the caller-supplied UReplaceableFunctor struct. Related
38 | * to the C++ class Replaceable.
39 | * This is currently only used in the Transliterator C API, see utrans.h .
40 | * @stable ICU 2.0
41 | */
42 | typedef void* UReplaceable;
43 |
44 | /**
45 | * A set of function pointers that transliterators use to manipulate a
46 | * UReplaceable. The caller should supply the required functions to
47 | * manipulate their text appropriately. Related to the C++ class
48 | * Replaceable.
49 | * @stable ICU 2.0
50 | */
51 | typedef struct UReplaceableCallbacks {
52 |
53 | /**
54 | * Function pointer that returns the number of UChar code units in
55 | * this text.
56 | *
57 | * @param rep A pointer to "this" UReplaceable object.
58 | * @return The length of the text.
59 | * @stable ICU 2.0
60 | */
61 | int32_t (*length)(const UReplaceable* rep);
62 |
63 | /**
64 | * Function pointer that returns a UChar code units at the given
65 | * offset into this text; 0 <= offset < n, where n is the value
66 | * returned by (*length)(rep). See unistr.h for a description of
67 | * charAt() vs. char32At().
68 | *
69 | * @param rep A pointer to "this" UReplaceable object.
70 | * @param offset The index at which to fetch the UChar (code unit).
71 | * @return The UChar (code unit) at offset, or U+FFFF if the offset is out of bounds.
72 | * @stable ICU 2.0
73 | */
74 | UChar (*charAt)(const UReplaceable* rep,
75 | int32_t offset);
76 |
77 | /**
78 | * Function pointer that returns a UChar32 code point at the given
79 | * offset into this text. See unistr.h for a description of
80 | * charAt() vs. char32At().
81 | *
82 | * @param rep A pointer to "this" UReplaceable object.
83 | * @param offset The index at which to fetch the UChar32 (code point).
84 | * @return The UChar32 (code point) at offset, or U+FFFF if the offset is out of bounds.
85 | * @stable ICU 2.0
86 | */
87 | UChar32 (*char32At)(const UReplaceable* rep,
88 | int32_t offset);
89 |
90 | /**
91 | * Function pointer that replaces text between start and limit in
92 | * this text with the given text. Attributes (out of band info)
93 | * should be retained.
94 | *
95 | * @param rep A pointer to "this" UReplaceable object.
96 | * @param start the starting index of the text to be replaced,
97 | * inclusive.
98 | * @param limit the ending index of the text to be replaced,
99 | * exclusive.
100 | * @param text the new text to replace the UChars from
101 | * start..limit-1.
102 | * @param textLength the number of UChars at text, or -1 if text
103 | * is null-terminated.
104 | * @stable ICU 2.0
105 | */
106 | void (*replace)(UReplaceable* rep,
107 | int32_t start,
108 | int32_t limit,
109 | const UChar* text,
110 | int32_t textLength);
111 |
112 | /**
113 | * Function pointer that copies the characters in the range
114 | * [start, limit) into the array dst.
115 | *
116 | * @param rep A pointer to "this" UReplaceable object.
117 | * @param start offset of first character which will be copied
118 | * into the array
119 | * @param limit offset immediately following the last character to
120 | * be copied
121 | * @param dst array in which to copy characters. The length of
122 | * dst must be at least (limit - start).
123 | * @stable ICU 2.1
124 | */
125 | void (*extract)(UReplaceable* rep,
126 | int32_t start,
127 | int32_t limit,
128 | UChar* dst);
129 |
130 | /**
131 | * Function pointer that copies text between start and limit in
132 | * this text to another index in the text. Attributes (out of
133 | * band info) should be retained. After this call, there will be
134 | * (at least) two copies of the characters originally located at
135 | * start..limit-1.
136 | *
137 | * @param rep A pointer to "this" UReplaceable object.
138 | * @param start the starting index of the text to be copied,
139 | * inclusive.
140 | * @param limit the ending index of the text to be copied,
141 | * exclusive.
142 | * @param dest the index at which the copy of the UChars should be
143 | * inserted.
144 | * @stable ICU 2.0
145 | */
146 | void (*copy)(UReplaceable* rep,
147 | int32_t start,
148 | int32_t limit,
149 | int32_t dest);
150 |
151 | } UReplaceableCallbacks;
152 |
153 | U_CDECL_END
154 |
155 | #endif
156 |
--------------------------------------------------------------------------------
/3rd/include/icu/unicode/ustream.h:
--------------------------------------------------------------------------------
1 | /*
2 | **********************************************************************
3 | * Copyright (C) 2001-2014 International Business Machines
4 | * Corporation and others. All Rights Reserved.
5 | **********************************************************************
6 | * FILE NAME : ustream.h
7 | *
8 | * Modification History:
9 | *
10 | * Date Name Description
11 | * 06/25/2001 grhoten Move iostream from unistr.h
12 | ******************************************************************************
13 | */
14 |
15 | #ifndef USTREAM_H
16 | #define USTREAM_H
17 |
18 | #include "unicode/unistr.h"
19 |
20 | #if !UCONFIG_NO_CONVERSION // not available without conversion
21 |
22 | /**
23 | * \file
24 | * \brief C++ API: Unicode iostream like API
25 | *
26 | * At this time, this API is very limited. It contains
27 | * operator<< and operator>> for UnicodeString manipulation with the
28 | * C++ I/O stream API.
29 | */
30 |
31 | #if !defined(_MSC_VER)
32 | namespace std { class type_info; } // WORKAROUND: http://llvm.org/bugs/show_bug.cgi?id=13364
33 | #endif
34 |
35 | #if U_IOSTREAM_SOURCE >= 199711
36 | #if (__GNUC__ == 2)
37 | #include ParsePosition
, since the index parameter
38 | * records the current position.
39 | *
40 | * The ParsePosition class is not suitable for subclassing.
41 | *
42 | * @version 1.3 10/30/97
43 | * @author Mark Davis, Helena Shih
44 | * @see java.text.Format
45 | */
46 |
47 | class U_COMMON_API ParsePosition : public UObject {
48 | public:
49 | /**
50 | * Default constructor, the index starts with 0 as default.
51 | * @stable ICU 2.0
52 | */
53 | ParsePosition()
54 | : UObject(),
55 | index(0),
56 | errorIndex(-1)
57 | {}
58 |
59 | /**
60 | * Create a new ParsePosition with the given initial index.
61 | * @param newIndex the new text offset.
62 | * @stable ICU 2.0
63 | */
64 | ParsePosition(int32_t newIndex)
65 | : UObject(),
66 | index(newIndex),
67 | errorIndex(-1)
68 | {}
69 |
70 | /**
71 | * Copy constructor
72 | * @param copy the object to be copied from.
73 | * @stable ICU 2.0
74 | */
75 | ParsePosition(const ParsePosition& copy)
76 | : UObject(copy),
77 | index(copy.index),
78 | errorIndex(copy.errorIndex)
79 | {}
80 |
81 | /**
82 | * Destructor
83 | * @stable ICU 2.0
84 | */
85 | virtual ~ParsePosition();
86 |
87 | /**
88 | * Assignment operator
89 | * @stable ICU 2.0
90 | */
91 | ParsePosition& operator=(const ParsePosition& copy);
92 |
93 | /**
94 | * Equality operator.
95 | * @return TRUE if the two parse positions are equal, FALSE otherwise.
96 | * @stable ICU 2.0
97 | */
98 | UBool operator==(const ParsePosition& that) const;
99 |
100 | /**
101 | * Equality operator.
102 | * @return TRUE if the two parse positions are not equal, FALSE otherwise.
103 | * @stable ICU 2.0
104 | */
105 | UBool operator!=(const ParsePosition& that) const;
106 |
107 | /**
108 | * Clone this object.
109 | * Clones can be used concurrently in multiple threads.
110 | * If an error occurs, then NULL is returned.
111 | * The caller must delete the clone.
112 | *
113 | * @return a clone of this object
114 | *
115 | * @see getDynamicClassID
116 | * @stable ICU 2.8
117 | */
118 | ParsePosition *clone() const;
119 |
120 | /**
121 | * Retrieve the current parse position. On input to a parse method, this
122 | * is the index of the character at which parsing will begin; on output, it
123 | * is the index of the character following the last character parsed.
124 | * @return the current index.
125 | * @stable ICU 2.0
126 | */
127 | int32_t getIndex(void) const;
128 |
129 | /**
130 | * Set the current parse position.
131 | * @param index the new index.
132 | * @stable ICU 2.0
133 | */
134 | void setIndex(int32_t index);
135 |
136 | /**
137 | * Set the index at which a parse error occurred. Formatters
138 | * should set this before returning an error code from their
139 | * parseObject method. The default value is -1 if this is not
140 | * set.
141 | * @stable ICU 2.0
142 | */
143 | void setErrorIndex(int32_t ei);
144 |
145 | /**
146 | * Retrieve the index at which an error occurred, or -1 if the
147 | * error index has not been set.
148 | * @stable ICU 2.0
149 | */
150 | int32_t getErrorIndex(void) const;
151 |
152 | /**
153 | * ICU "poor man's RTTI", returns a UClassID for this class.
154 | *
155 | * @stable ICU 2.2
156 | */
157 | static UClassID U_EXPORT2 getStaticClassID();
158 |
159 | /**
160 | * ICU "poor man's RTTI", returns a UClassID for the actual class.
161 | *
162 | * @stable ICU 2.2
163 | */
164 | virtual UClassID getDynamicClassID() const;
165 |
166 | private:
167 | /**
168 | * Input: the place you start parsing.
169 | *
Output: position where the parse stopped.
170 | * This is designed to be used serially,
171 | * with each call setting index up for the next one.
172 | */
173 | int32_t index;
174 |
175 | /**
176 | * The index at which a parse error occurred.
177 | */
178 | int32_t errorIndex;
179 |
180 | };
181 |
182 | inline ParsePosition&
183 | ParsePosition::operator=(const ParsePosition& copy)
184 | {
185 | index = copy.index;
186 | errorIndex = copy.errorIndex;
187 | return *this;
188 | }
189 |
190 | inline UBool
191 | ParsePosition::operator==(const ParsePosition& copy) const
192 | {
193 | if(index != copy.index || errorIndex != copy.errorIndex)
194 | return FALSE;
195 | else
196 | return TRUE;
197 | }
198 |
199 | inline UBool
200 | ParsePosition::operator!=(const ParsePosition& copy) const
201 | {
202 | return !operator==(copy);
203 | }
204 |
205 | inline int32_t
206 | ParsePosition::getIndex() const
207 | {
208 | return index;
209 | }
210 |
211 | inline void
212 | ParsePosition::setIndex(int32_t offset)
213 | {
214 | this->index = offset;
215 | }
216 |
217 | inline int32_t
218 | ParsePosition::getErrorIndex() const
219 | {
220 | return errorIndex;
221 | }
222 |
223 | inline void
224 | ParsePosition::setErrorIndex(int32_t ei)
225 | {
226 | this->errorIndex = ei;
227 | }
228 | U_NAMESPACE_END
229 |
230 | #endif
231 |
--------------------------------------------------------------------------------
/3rd/include/icu/unicode/ptypes.h:
--------------------------------------------------------------------------------
1 | /*
2 | ******************************************************************************
3 | *
4 | * Copyright (C) 1997-2012, International Business Machines
5 | * Corporation and others. All Rights Reserved.
6 | *
7 | ******************************************************************************
8 | *
9 | * FILE NAME : ptypes.h
10 | *
11 | * Date Name Description
12 | * 05/13/98 nos Creation (content moved here from ptypes.h).
13 | * 03/02/99 stephen Added AS400 support.
14 | * 03/30/99 stephen Added Linux support.
15 | * 04/13/99 stephen Reworked for autoconf.
16 | * 09/18/08 srl Moved basic types back to ptypes.h from platform.h
17 | ******************************************************************************
18 | */
19 |
20 | /**
21 | * \file
22 | * \brief C API: Definitions of integer types of various widths
23 | */
24 |
25 | #ifndef _PTYPES_H
26 | #define _PTYPES_H
27 |
28 | /**
29 | * \def __STDC_LIMIT_MACROS
30 | * According to the Linux stdint.h, the ISO C99 standard specifies that in C++ implementations
31 | * macros like INT32_MIN and UINTPTR_MAX should only be defined if explicitly requested.
32 | * We need to define __STDC_LIMIT_MACROS before including stdint.h in C++ code
33 | * that uses such limit macros.
34 | * @internal
35 | */
36 | #ifndef __STDC_LIMIT_MACROS
37 | #define __STDC_LIMIT_MACROS
38 | #endif
39 |
40 | /* NULL, size_t, wchar_t */
41 | #include
56 | * \code
57 | * #define ICU_DATA_DIR "path"
58 | * \endcode
59 | *
use that,
60 | * otherwise no data directory is available.
61 | *
62 | * @return the data directory, or an empty string ("") if no data directory has
63 | * been specified.
64 | *
65 | * @stable ICU 2.0
66 | */
67 | U_STABLE const char* U_EXPORT2 u_getDataDirectory(void);
68 |
69 |
70 | /**
71 | * Set the ICU data directory.
72 | * The data directory is where common format ICU data files (.dat files)
73 | * are loaded from. Note that normal use of the built-in ICU
74 | * facilities does not require loading of an external data file;
75 | * unless you are adding custom data to ICU, the data directory
76 | * does not need to be set.
77 | *
78 | * This function should be called at most once in a process, before the
79 | * first ICU operation (e.g., u_init()) that will require the loading of an
80 | * ICU data file.
81 | * This function is not thread-safe. Use it before calling ICU APIs from
82 | * multiple threads.
83 | *
84 | * @param directory The directory to be set.
85 | *
86 | * @see u_init
87 | * @stable ICU 2.0
88 | */
89 | U_STABLE void U_EXPORT2 u_setDataDirectory(const char *directory);
90 |
91 | #ifndef U_HIDE_INTERNAL_API
92 | /**
93 | * Return the time zone files override directory, or an empty string if
94 | * no directory was specified. Certain time zone resources will be preferrentially
95 | * loaded from individual files in this directory.
96 | *
97 | * @return the time zone data override directory.
98 | * @internal
99 | */
100 | U_INTERNAL const char * U_EXPORT2 u_getTimeZoneFilesDirectory(UErrorCode *status);
101 |
102 | /**
103 | * Set the time zone files override directory.
104 | * This function is not thread safe; it must not be called concurrently with
105 | * u_getTimeZoneFilesDirectory() or any other use of ICU time zone functions.
106 | * This function should only be called before using any ICU service that
107 | * will access the time zone data.
108 | * @internal
109 | */
110 | U_INTERNAL void U_EXPORT2 u_setTimeZoneFilesDirectory(const char *path, UErrorCode *status);
111 | #endif /* U_HIDE_INTERNAL_API */
112 |
113 |
114 | /**
115 | * @{
116 | * Filesystem file and path separator characters.
117 | * Example: '/' and ':' on Unix, '\\' and ';' on Windows.
118 | * @stable ICU 2.0
119 | */
120 | #if U_PLATFORM_USES_ONLY_WIN32_API
121 | # define U_FILE_SEP_CHAR '\\'
122 | # define U_FILE_ALT_SEP_CHAR '/'
123 | # define U_PATH_SEP_CHAR ';'
124 | # define U_FILE_SEP_STRING "\\"
125 | # define U_FILE_ALT_SEP_STRING "/"
126 | # define U_PATH_SEP_STRING ";"
127 | #else
128 | # define U_FILE_SEP_CHAR '/'
129 | # define U_FILE_ALT_SEP_CHAR '/'
130 | # define U_PATH_SEP_CHAR ':'
131 | # define U_FILE_SEP_STRING "/"
132 | # define U_FILE_ALT_SEP_STRING "/"
133 | # define U_PATH_SEP_STRING ":"
134 | #endif
135 |
136 | /** @} */
137 |
138 | /**
139 | * Convert char characters to UChar characters.
140 | * This utility function is useful only for "invariant characters"
141 | * that are encoded in the platform default encoding.
142 | * They are a small, constant subset of the encoding and include
143 | * just the latin letters, digits, and some punctuation.
144 | * For details, see U_CHARSET_FAMILY.
145 | *
146 | * @param cs Input string, points to length
147 | * character bytes from a subset of the platform encoding.
148 | * @param us Output string, points to memory for length
149 | * Unicode characters.
150 | * @param length The number of characters to convert; this may
151 | * include the terminating NUL
.
152 | *
153 | * @see U_CHARSET_FAMILY
154 | * @stable ICU 2.0
155 | */
156 | U_STABLE void U_EXPORT2
157 | u_charsToUChars(const char *cs, UChar *us, int32_t length);
158 |
159 | /**
160 | * Convert UChar characters to char characters.
161 | * This utility function is useful only for "invariant characters"
162 | * that can be encoded in the platform default encoding.
163 | * They are a small, constant subset of the encoding and include
164 | * just the latin letters, digits, and some punctuation.
165 | * For details, see U_CHARSET_FAMILY.
166 | *
167 | * @param us Input string, points to length
168 | * Unicode characters that can be encoded with the
169 | * codepage-invariant subset of the platform encoding.
170 | * @param cs Output string, points to memory for length
171 | * character bytes.
172 | * @param length The number of characters to convert; this may
173 | * include the terminating NUL
.
174 | *
175 | * @see U_CHARSET_FAMILY
176 | * @stable ICU 2.0
177 | */
178 | U_STABLE void U_EXPORT2
179 | u_UCharsToChars(const UChar *us, char *cs, int32_t length);
180 |
181 | #endif
182 |
--------------------------------------------------------------------------------
/3rd/include/icu/unicode/schriter.h:
--------------------------------------------------------------------------------
1 | /*
2 | ******************************************************************************
3 | *
4 | * Copyright (C) 1998-2005, International Business Machines
5 | * Corporation and others. All Rights Reserved.
6 | *
7 | ******************************************************************************
8 | *
9 | * File schriter.h
10 | *
11 | * Modification History:
12 | *
13 | * Date Name Description
14 | * 05/05/99 stephen Cleaned up.
15 | ******************************************************************************
16 | */
17 |
18 | #ifndef SCHRITER_H
19 | #define SCHRITER_H
20 |
21 | #include "unicode/utypes.h"
22 | #include "unicode/chariter.h"
23 | #include "unicode/uchriter.h"
24 |
25 | /**
26 | * \file
27 | * \brief C++ API: String Character Iterator
28 | */
29 |
30 | U_NAMESPACE_BEGIN
31 | /**
32 | * A concrete subclass of CharacterIterator that iterates over the
33 | * characters (code units or code points) in a UnicodeString.
34 | * It's possible not only to create an
35 | * iterator that iterates over an entire UnicodeString, but also to
36 | * create one that iterates over only a subrange of a UnicodeString
37 | * (iterators over different subranges of the same UnicodeString don't
38 | * compare equal).
39 | * @see CharacterIterator
40 | * @see ForwardCharacterIterator
41 | * @stable ICU 2.0
42 | */
43 | class U_COMMON_API StringCharacterIterator : public UCharCharacterIterator {
44 | public:
45 | /**
46 | * Create an iterator over the UnicodeString referred to by "textStr".
47 | * The UnicodeString object is copied.
48 | * The iteration range is the whole string, and the starting position is 0.
49 | * @param textStr The unicode string used to create an iterator
50 | * @stable ICU 2.0
51 | */
52 | StringCharacterIterator(const UnicodeString& textStr);
53 |
54 | /**
55 | * Create an iterator over the UnicodeString referred to by "textStr".
56 | * The iteration range is the whole string, and the starting
57 | * position is specified by "textPos". If "textPos" is outside the valid
58 | * iteration range, the behavior of this object is undefined.
59 | * @param textStr The unicode string used to create an iterator
60 | * @param textPos The starting position of the iteration
61 | * @stable ICU 2.0
62 | */
63 | StringCharacterIterator(const UnicodeString& textStr,
64 | int32_t textPos);
65 |
66 | /**
67 | * Create an iterator over the UnicodeString referred to by "textStr".
68 | * The UnicodeString object is copied.
69 | * The iteration range begins with the code unit specified by
70 | * "textBegin" and ends with the code unit BEFORE the code unit specfied
71 | * by "textEnd". The starting position is specified by "textPos". If
72 | * "textBegin" and "textEnd" don't form a valid range on "text" (i.e.,
73 | * textBegin >= textEnd or either is negative or greater than text.size()),
74 | * or "textPos" is outside the range defined by "textBegin" and "textEnd",
75 | * the behavior of this iterator is undefined.
76 | * @param textStr The unicode string used to create the StringCharacterIterator
77 | * @param textBegin The begin position of the iteration range
78 | * @param textEnd The end position of the iteration range
79 | * @param textPos The starting position of the iteration
80 | * @stable ICU 2.0
81 | */
82 | StringCharacterIterator(const UnicodeString& textStr,
83 | int32_t textBegin,
84 | int32_t textEnd,
85 | int32_t textPos);
86 |
87 | /**
88 | * Copy constructor. The new iterator iterates over the same range
89 | * of the same string as "that", and its initial position is the
90 | * same as "that"'s current position.
91 | * The UnicodeString object in "that" is copied.
92 | * @param that The StringCharacterIterator to be copied
93 | * @stable ICU 2.0
94 | */
95 | StringCharacterIterator(const StringCharacterIterator& that);
96 |
97 | /**
98 | * Destructor.
99 | * @stable ICU 2.0
100 | */
101 | virtual ~StringCharacterIterator();
102 |
103 | /**
104 | * Assignment operator. *this is altered to iterate over the same
105 | * range of the same string as "that", and refers to the same
106 | * character within that string as "that" does.
107 | * @param that The object to be copied.
108 | * @return the newly created object.
109 | * @stable ICU 2.0
110 | */
111 | StringCharacterIterator&
112 | operator=(const StringCharacterIterator& that);
113 |
114 | /**
115 | * Returns true if the iterators iterate over the same range of the
116 | * same string and are pointing at the same character.
117 | * @param that The ForwardCharacterIterator to be compared for equality
118 | * @return true if the iterators iterate over the same range of the
119 | * same string and are pointing at the same character.
120 | * @stable ICU 2.0
121 | */
122 | virtual UBool operator==(const ForwardCharacterIterator& that) const;
123 |
124 | /**
125 | * Returns a new StringCharacterIterator referring to the same
126 | * character in the same range of the same string as this one. The
127 | * caller must delete the new iterator.
128 | * @return the newly cloned object.
129 | * @stable ICU 2.0
130 | */
131 | virtual CharacterIterator* clone(void) const;
132 |
133 | /**
134 | * Sets the iterator to iterate over the provided string.
135 | * @param newText The string to be iterated over
136 | * @stable ICU 2.0
137 | */
138 | void setText(const UnicodeString& newText);
139 |
140 | /**
141 | * Copies the UnicodeString under iteration into the UnicodeString
142 | * referred to by "result". Even if this iterator iterates across
143 | * only a part of this string, the whole string is copied.
144 | * @param result Receives a copy of the text under iteration.
145 | * @stable ICU 2.0
146 | */
147 | virtual void getText(UnicodeString& result);
148 |
149 | /**
150 | * Return a class ID for this object (not really public)
151 | * @return a class ID for this object.
152 | * @stable ICU 2.0
153 | */
154 | virtual UClassID getDynamicClassID(void) const;
155 |
156 | /**
157 | * Return a class ID for this class (not really public)
158 | * @return a class ID for this class
159 | * @stable ICU 2.0
160 | */
161 | static UClassID U_EXPORT2 getStaticClassID(void);
162 |
163 | protected:
164 | /**
165 | * Default constructor, iteration over empty string.
166 | * @stable ICU 2.0
167 | */
168 | StringCharacterIterator();
169 |
170 | /**
171 | * Sets the iterator to iterate over the provided string.
172 | * @param newText The string to be iterated over
173 | * @param newTextLength The length of the String
174 | * @stable ICU 2.0
175 | */
176 | void setText(const UChar* newText, int32_t newTextLength);
177 |
178 | /**
179 | * Copy of the iterated string object.
180 | * @stable ICU 2.0
181 | */
182 | UnicodeString text;
183 |
184 | };
185 |
186 | U_NAMESPACE_END
187 | #endif
188 |
--------------------------------------------------------------------------------
/3rd/include/icu/unicode/scientificformathelper.h:
--------------------------------------------------------------------------------
1 | /*
2 | **********************************************************************
3 | * Copyright (c) 2014, International Business Machines
4 | * Corporation and others. All Rights Reserved.
5 | **********************************************************************
6 | */
7 | #ifndef SCIFORMATHELPER_H
8 | #define SCIFORMATHELPER_H
9 |
10 | #include "unicode/utypes.h"
11 |
12 | #if !UCONFIG_NO_FORMATTING
13 |
14 | #ifndef U_HIDE_DRAFT_API
15 |
16 | #include "unicode/unistr.h"
17 |
18 | /**
19 | * \file
20 | * \brief C++ API: Formatter for measure objects.
21 | */
22 |
23 | U_NAMESPACE_BEGIN
24 |
25 | class DecimalFormatSymbols;
26 | class FieldPositionIterator;
27 | class DecimalFormatStaticSets;
28 |
29 | /**
30 | * A helper class for formatting numbers in standard scientific notation
31 | * instead of E notation.
32 | *
33 | * Sample code:
34 | *
35 | * UErrorCode status = U_ZERO_ERROR;
36 | * DecimalFormat *decfmt = (DecimalFormat *)
37 | * NumberFormat::createScientificInstance("en", status);
38 | * UnicodeString appendTo;
39 | * FieldPositionIterator fpositer;
40 | * decfmt->format(1.23456e-78, appendTo, &fpositer, status);
41 | * ScientificFormatHelper helper(*decfmt->getDecimalFormatSymbols(), status);
42 | * UnicodeString result;
43 | *
44 | * // result = "1.23456x10-78"
45 | * helper.insertMarkup(appendTo, fpositer, "", "", result, status));
46 | *
47 | *
48 | * @see NumberFormat
49 | * @draft ICU 54
50 | */
51 | class U_I18N_API ScientificFormatHelper : public UObject {
52 | public:
53 | /**
54 | * Constructor.
55 | * @param symbols comes from DecimalFormat instance used for default
56 | * scientific notation.
57 | * @param status any error reported here.
58 | * @draft ICU 54
59 | */
60 | ScientificFormatHelper(const DecimalFormatSymbols &symbols, UErrorCode& status);
61 |
62 | /**
63 | * Copy constructor.
64 | * @draft ICU 54
65 | */
66 | ScientificFormatHelper(const ScientificFormatHelper &other);
67 |
68 | /**
69 | * Assignment operator.
70 | * @draft ICU 54
71 | */
72 | ScientificFormatHelper &operator=(const ScientificFormatHelper &other);
73 |
74 | /**
75 | * Destructor.
76 | * @draft ICU 54
77 | */
78 | virtual ~ScientificFormatHelper();
79 |
80 | /**
81 | * Formats standard scientific notation by surrounding exponent with
82 | * html to make it superscript.
83 | * @param s the original formatted scientific notation
84 | * e.g "6.02e23". s is output from
85 | * NumberFormat::createScientificInstance()->format().
86 | * @param fpi the FieldPositionIterator from the format call.
87 | * fpi is output from
88 | * NumberFormat::createScientificInstance()->format().
89 | * @param beginMarkup the start html for the exponent e.g ""
90 | * @param endMarkup the end html for the exponent e.g ""
91 | * @param result standard scientific notation appended here.
92 | * @param status any error returned here. When status is set to a
93 | * non-zero error, the value of result is unspecified,
94 | * and client should fallback to using s for scientific
95 | * notation.
96 | * @return the value stored in result.
97 | * @draft ICU 54
98 | */
99 | UnicodeString &insertMarkup(
100 | const UnicodeString &s,
101 | FieldPositionIterator &fpi,
102 | const UnicodeString &beginMarkup,
103 | const UnicodeString &endMarkup,
104 | UnicodeString &result,
105 | UErrorCode &status) const;
106 |
107 | /**
108 | * Formats standard scientific notation by using superscript unicode
109 | * points 0..9.
110 | * @param s the original formatted scientific notation
111 | * e.g "6.02e23". s is output from
112 | * NumberFormat::createScientificInstance()->format().
113 | * @param fpi the FieldPositionIterator from the format call.
114 | * fpi is output from
115 | * NumberFormat::createScientificInstance()->format().
116 | * @param result standard scientific notation appended here.
117 | * @param status any error returned here. When status is set to a
118 | * non-zero error, the value of result is unspecified,
119 | * and client should fallback to using s for scientific
120 | * notation.
121 | * @return the value stored in result.
122 | * @draft ICU 54
123 | */
124 | UnicodeString &toSuperscriptExponentDigits(
125 | const UnicodeString &s,
126 | FieldPositionIterator &fpi,
127 | UnicodeString &result,
128 | UErrorCode &status) const;
129 | private:
130 | UnicodeString fPreExponent;
131 | const DecimalFormatStaticSets *fStaticSets;
132 | };
133 |
134 | U_NAMESPACE_END
135 |
136 | #endif /* U_HIDE_DRAFT_API */
137 |
138 | #endif /* !UCONFIG_NO_FORMATTING */
139 | #endif
140 |
--------------------------------------------------------------------------------
/3rd/include/icu/unicode/std_string.h:
--------------------------------------------------------------------------------
1 | /*
2 | *******************************************************************************
3 | *
4 | * Copyright (C) 2009-2014, International Business Machines
5 | * Corporation and others. All Rights Reserved.
6 | *
7 | *******************************************************************************
8 | * file name: std_string.h
9 | * encoding: US-ASCII
10 | * tab size: 8 (not used)
11 | * indentation:4
12 | *
13 | * created on: 2009feb19
14 | * created by: Markus W. Scherer
15 | */
16 |
17 | #ifndef __STD_STRING_H__
18 | #define __STD_STRING_H__
19 |
20 | /**
21 | * \file
22 | * \brief C++ API: Central ICU header for including the C++ standard <string>
23 | * header and for related definitions.
24 | */
25 |
26 | #include "unicode/utypes.h"
27 |
28 | #if U_HAVE_STD_STRING
29 |
30 | #if !defined(_MSC_VER)
31 | namespace std { class type_info; } // WORKAROUND: http://llvm.org/bugs/show_bug.cgi?id=13364
32 | #endif
33 | #include
116 | * . Base* polymorphic_pointer = createPolymorphicObject();
117 | * . if (polymorphic_pointer->getDynamicClassID() ==
118 | * . erived::getStaticClassID()) ...
119 | *
120 | * @return The class ID for all objects of this class.
121 | * @stable ICU 4.2
122 | */
123 | static UClassID U_EXPORT2 getStaticClassID(void);
124 |
125 |
126 | /**
127 | * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
128 | * method is to implement a simple version of RTTI, since not all C++
129 | * compilers support genuine RTTI. Polymorphic operator==() and clone()
130 | * methods call this method.
131 | *
132 | * @return The class ID for this object. All objects of a
133 | * given class have the same class ID. Objects of
134 | * other classes have different class IDs.
135 | * @stable ICU 4.2
136 | */
137 | virtual UClassID getDynamicClassID(void) const;
138 |
139 |
140 | /**
141 | * Get the time unit.
142 | * @return time unit object.
143 | * @stable ICU 4.2
144 | */
145 | const TimeUnit& getTimeUnit() const;
146 |
147 | /**
148 | * Get the time unit field value.
149 | * @return time unit field value.
150 | * @stable ICU 4.2
151 | */
152 | TimeUnit::UTimeUnitFields getTimeUnitField() const;
153 | };
154 |
155 |
156 |
157 | inline UBool
158 | TimeUnitAmount::operator!=(const UObject& other) const {
159 | return !operator==(other);
160 | }
161 |
162 | U_NAMESPACE_END
163 |
164 | #endif /* #if !UCONFIG_NO_FORMATTING */
165 |
166 | #endif // __TMUTAMT_H__
167 | //eof
168 | //
169 |
--------------------------------------------------------------------------------
/3rd/include/icu/unicode/tztrans.h:
--------------------------------------------------------------------------------
1 | /*
2 | *******************************************************************************
3 | * Copyright (C) 2007-2008, International Business Machines Corporation and *
4 | * others. All Rights Reserved. *
5 | *******************************************************************************
6 | */
7 | #ifndef TZTRANS_H
8 | #define TZTRANS_H
9 |
10 | /**
11 | * \file
12 | * \brief C++ API: Time zone transition
13 | */
14 |
15 | #include "unicode/utypes.h"
16 |
17 | #if !UCONFIG_NO_FORMATTING
18 |
19 | #include "unicode/uobject.h"
20 |
21 | U_NAMESPACE_BEGIN
22 |
23 | // Forward declaration
24 | class TimeZoneRule;
25 |
26 | /**
27 | * TimeZoneTransition
is a class representing a time zone transition.
28 | * An instance has a time of transition and rules for both before and after the transition.
29 | * @stable ICU 3.8
30 | */
31 | class U_I18N_API TimeZoneTransition : public UObject {
32 | public:
33 | /**
34 | * Constructs a TimeZoneTransition
with the time and the rules before/after
35 | * the transition.
36 | *
37 | * @param time The time of transition in milliseconds since the base time.
38 | * @param from The time zone rule used before the transition.
39 | * @param to The time zone rule used after the transition.
40 | * @stable ICU 3.8
41 | */
42 | TimeZoneTransition(UDate time, const TimeZoneRule& from, const TimeZoneRule& to);
43 |
44 | /**
45 | * Constructs an empty TimeZoneTransition
46 | * @stable ICU 3.8
47 | */
48 | TimeZoneTransition();
49 |
50 | /**
51 | * Copy constructor.
52 | * @param source The TimeZoneTransition object to be copied.
53 | * @stable ICU 3.8
54 | */
55 | TimeZoneTransition(const TimeZoneTransition& source);
56 |
57 | /**
58 | * Destructor.
59 | * @stable ICU 3.8
60 | */
61 | ~TimeZoneTransition();
62 |
63 | /**
64 | * Clone this TimeZoneTransition object polymorphically. The caller owns the result and
65 | * should delete it when done.
66 | * @return A copy of the object.
67 | * @stable ICU 3.8
68 | */
69 | TimeZoneTransition* clone(void) const;
70 |
71 | /**
72 | * Assignment operator.
73 | * @param right The object to be copied.
74 | * @stable ICU 3.8
75 | */
76 | TimeZoneTransition& operator=(const TimeZoneTransition& right);
77 |
78 | /**
79 | * Return true if the given TimeZoneTransition objects are semantically equal. Objects
80 | * of different subclasses are considered unequal.
81 | * @param that The object to be compared with.
82 | * @return true if the given TimeZoneTransition objects are semantically equal.
83 | * @stable ICU 3.8
84 | */
85 | UBool operator==(const TimeZoneTransition& that) const;
86 |
87 | /**
88 | * Return true if the given TimeZoneTransition objects are semantically unequal. Objects
89 | * of different subclasses are considered unequal.
90 | * @param that The object to be compared with.
91 | * @return true if the given TimeZoneTransition objects are semantically unequal.
92 | * @stable ICU 3.8
93 | */
94 | UBool operator!=(const TimeZoneTransition& that) const;
95 |
96 | /**
97 | * Returns the time of transition in milliseconds.
98 | * @return The time of the transition in milliseconds since the 1970 Jan 1 epoch time.
99 | * @stable ICU 3.8
100 | */
101 | UDate getTime(void) const;
102 |
103 | /**
104 | * Sets the time of transition in milliseconds.
105 | * @param time The time of the transition in milliseconds since the 1970 Jan 1 epoch time.
106 | * @stable ICU 3.8
107 | */
108 | void setTime(UDate time);
109 |
110 | /**
111 | * Returns the rule used before the transition.
112 | * @return The time zone rule used after the transition.
113 | * @stable ICU 3.8
114 | */
115 | const TimeZoneRule* getFrom(void) const;
116 |
117 | /**
118 | * Sets the rule used before the transition. The caller remains
119 | * responsible for deleting the TimeZoneRule
object.
120 | * @param from The time zone rule used before the transition.
121 | * @stable ICU 3.8
122 | */
123 | void setFrom(const TimeZoneRule& from);
124 |
125 | /**
126 | * Adopts the rule used before the transition. The caller must
127 | * not delete the TimeZoneRule
object passed in.
128 | * @param from The time zone rule used before the transition.
129 | * @stable ICU 3.8
130 | */
131 | void adoptFrom(TimeZoneRule* from);
132 |
133 | /**
134 | * Sets the rule used after the transition. The caller remains
135 | * responsible for deleting the TimeZoneRule
object.
136 | * @param to The time zone rule used after the transition.
137 | * @stable ICU 3.8
138 | */
139 | void setTo(const TimeZoneRule& to);
140 |
141 | /**
142 | * Adopts the rule used after the transition. The caller must
143 | * not delete the TimeZoneRule
object passed in.
144 | * @param to The time zone rule used after the transition.
145 | * @stable ICU 3.8
146 | */
147 | void adoptTo(TimeZoneRule* to);
148 |
149 | /**
150 | * Returns the rule used after the transition.
151 | * @return The time zone rule used after the transition.
152 | * @stable ICU 3.8
153 | */
154 | const TimeZoneRule* getTo(void) const;
155 |
156 | private:
157 | UDate fTime;
158 | TimeZoneRule* fFrom;
159 | TimeZoneRule* fTo;
160 |
161 | public:
162 | /**
163 | * Return the class ID for this class. This is useful only for comparing to
164 | * a return value from getDynamicClassID(). For example:
165 | *
166 | * . Base* polymorphic_pointer = createPolymorphicObject();
167 | * . if (polymorphic_pointer->getDynamicClassID() ==
168 | * . erived::getStaticClassID()) ...
169 | *
170 | * @return The class ID for all objects of this class.
171 | * @stable ICU 3.8
172 | */
173 | static UClassID U_EXPORT2 getStaticClassID(void);
174 |
175 | /**
176 | * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
177 | * method is to implement a simple version of RTTI, since not all C++
178 | * compilers support genuine RTTI. Polymorphic operator==() and clone()
179 | * methods call this method.
180 | *
181 | * @return The class ID for this object. All objects of a
182 | * given class have the same class ID. Objects of
183 | * other classes have different class IDs.
184 | * @stable ICU 3.8
185 | */
186 | virtual UClassID getDynamicClassID(void) const;
187 | };
188 |
189 | U_NAMESPACE_END
190 |
191 | #endif /* #if !UCONFIG_NO_FORMATTING */
192 |
193 | #endif // TZTRANS_H
194 |
195 | //eof
196 |
--------------------------------------------------------------------------------
/3rd/include/icu/unicode/ucat.h:
--------------------------------------------------------------------------------
1 | /*
2 | **********************************************************************
3 | * Copyright (c) 2003-2004, International Business Machines
4 | * Corporation and others. All Rights Reserved.
5 | **********************************************************************
6 | * Author: Alan Liu
7 | * Created: March 19 2003
8 | * Since: ICU 2.6
9 | **********************************************************************
10 | */
11 | #ifndef UCAT_H
12 | #define UCAT_H
13 |
14 | #include "unicode/utypes.h"
15 | #include "unicode/ures.h"
16 |
17 | /**
18 | * \file
19 | * \brief C API: Message Catalog Wrappers
20 | *
21 | * This C API provides look-alike functions that deliberately resemble
22 | * the POSIX catopen, catclose, and catgets functions. The underlying
23 | * implementation is in terms of ICU resource bundles, rather than
24 | * POSIX message catalogs.
25 | *
26 | * The ICU resource bundles obey standard ICU inheritance policies.
27 | * To facilitate this, sets and messages are flattened into one tier.
28 | * This is done by creating resource bundle keys of the form
29 | * <set_num>%<msg_num> where set_num is the set number and msg_num is
30 | * the message number, formatted as decimal strings.
31 | *
32 | * Example: Consider a message catalog containing two sets:
33 | *
34 | * Set 1: Message 4 = "Good morning."
35 | * Message 5 = "Good afternoon."
36 | * Message 7 = "Good evening."
37 | * Message 8 = "Good night."
38 | * Set 4: Message 14 = "Please "
39 | * Message 19 = "Thank you."
40 | * Message 20 = "Sincerely,"
41 | *
42 | * The ICU resource bundle source file would, assuming it is named
43 | * "greet.txt", would look like this:
44 | *
45 | * greet
46 | * {
47 | * 1%4 { "Good morning." }
48 | * 1%5 { "Good afternoon." }
49 | * 1%7 { "Good evening." }
50 | * 1%8 { "Good night." }
51 | *
52 | * 4%14 { "Please " }
53 | * 4%19 { "Thank you." }
54 | * 4%20 { "Sincerely," }
55 | * }
56 | *
57 | * The catgets function is commonly used in combination with functions
58 | * like printf and strftime. ICU components like message format can
59 | * be used instead, although they use a different format syntax.
60 | * There is an ICU package, icuio, that provides some of
61 | * the POSIX-style formatting API.
62 | */
63 |
64 | U_CDECL_BEGIN
65 |
66 | /**
67 | * An ICU message catalog descriptor, analogous to nl_catd.
68 | *
69 | * @stable ICU 2.6
70 | */
71 | typedef UResourceBundle* u_nl_catd;
72 |
73 | /**
74 | * Open and return an ICU message catalog descriptor. The descriptor
75 | * may be passed to u_catgets() to retrieve localized strings.
76 | *
77 | * @param name string containing the full path pointing to the
78 | * directory where the resources reside followed by the package name
79 | * e.g. "/usr/resource/my_app/resources/guimessages" on a Unix system.
80 | * If NULL, ICU default data files will be used.
81 | *
82 | * Unlike POSIX, environment variables are not interpolated within the
83 | * name.
84 | *
85 | * @param locale the locale for which we want to open the resource. If
86 | * NULL, the default ICU locale will be used (see uloc_getDefault). If
87 | * strlen(locale) == 0, the root locale will be used.
88 | *
89 | * @param ec input/output error code. Upon output,
90 | * U_USING_FALLBACK_WARNING indicates that a fallback locale was
91 | * used. For example, 'de_CH' was requested, but nothing was found
92 | * there, so 'de' was used. U_USING_DEFAULT_WARNING indicates that the
93 | * default locale data or root locale data was used; neither the
94 | * requested locale nor any of its fallback locales were found.
95 | *
96 | * @return a message catalog descriptor that may be passed to
97 | * u_catgets(). If the ec parameter indicates success, then the caller
98 | * is responsible for calling u_catclose() to close the message
99 | * catalog. If the ec parameter indicates failure, then NULL will be
100 | * returned.
101 | *
102 | * @stable ICU 2.6
103 | */
104 | U_STABLE u_nl_catd U_EXPORT2
105 | u_catopen(const char* name, const char* locale, UErrorCode* ec);
106 |
107 | /**
108 | * Close an ICU message catalog, given its descriptor.
109 | *
110 | * @param catd a message catalog descriptor to be closed. May be NULL,
111 | * in which case no action is taken.
112 | *
113 | * @stable ICU 2.6
114 | */
115 | U_STABLE void U_EXPORT2
116 | u_catclose(u_nl_catd catd);
117 |
118 | /**
119 | * Retrieve a localized string from an ICU message catalog.
120 | *
121 | * @param catd a message catalog descriptor returned by u_catopen.
122 | *
123 | * @param set_num the message catalog set number. Sets need not be
124 | * numbered consecutively.
125 | *
126 | * @param msg_num the message catalog message number within the
127 | * set. Messages need not be numbered consecutively.
128 | *
129 | * @param s the default string. This is returned if the string
130 | * specified by the set_num and msg_num is not found. It must be
131 | * zero-terminated.
132 | *
133 | * @param len fill-in parameter to receive the length of the result.
134 | * May be NULL, in which case it is ignored.
135 | *
136 | * @param ec input/output error code. May be U_USING_FALLBACK_WARNING
137 | * or U_USING_DEFAULT_WARNING. U_MISSING_RESOURCE_ERROR indicates that
138 | * the set_num/msg_num tuple does not specify a valid message string
139 | * in this catalog.
140 | *
141 | * @return a pointer to a zero-terminated UChar array which lives in
142 | * an internal buffer area, typically a memory mapped/DLL file. The
143 | * caller must NOT delete this pointer. If the call is unsuccessful
144 | * for any reason, then s is returned. This includes the situation in
145 | * which ec indicates a failing error code upon entry to this
146 | * function.
147 | *
148 | * @stable ICU 2.6
149 | */
150 | U_STABLE const UChar* U_EXPORT2
151 | u_catgets(u_nl_catd catd, int32_t set_num, int32_t msg_num,
152 | const UChar* s,
153 | int32_t* len, UErrorCode* ec);
154 |
155 | U_CDECL_END
156 |
157 | #endif /*UCAT_H*/
158 | /*eof*/
159 |
--------------------------------------------------------------------------------
/3rd/include/icu/unicode/ucnvsel.h:
--------------------------------------------------------------------------------
1 | /*
2 | *******************************************************************************
3 | *
4 | * Copyright (C) 2008-2011, International Business Machines
5 | * Corporation, Google and others. All Rights Reserved.
6 | *
7 | *******************************************************************************
8 | */
9 | /*
10 | * Author : eldawy@google.com (Mohamed Eldawy)
11 | * ucnvsel.h
12 | *
13 | * Purpose: To generate a list of encodings capable of handling
14 | * a given Unicode text
15 | *
16 | * Started 09-April-2008
17 | */
18 |
19 | #ifndef __ICU_UCNV_SEL_H__
20 | #define __ICU_UCNV_SEL_H__
21 |
22 | #include "unicode/utypes.h"
23 |
24 | #if !UCONFIG_NO_CONVERSION
25 |
26 | #include "unicode/uset.h"
27 | #include "unicode/utf16.h"
28 | #include "unicode/uenum.h"
29 | #include "unicode/ucnv.h"
30 | #include "unicode/localpointer.h"
31 |
32 | /**
33 | * \file
34 | *
35 | * A converter selector is built with a set of encoding/charset names
36 | * and given an input string returns the set of names of the
37 | * corresponding converters which can convert the string.
38 | *
39 | * A converter selector can be serialized into a buffer and reopened
40 | * from the serialized form.
41 | */
42 |
43 | /**
44 | * @{
45 | * The selector data structure
46 | */
47 | struct UConverterSelector;
48 | typedef struct UConverterSelector UConverterSelector;
49 | /** @} */
50 |
51 | /**
52 | * Open a selector.
53 | * If converterListSize is 0, build for all available converters.
54 | * If excludedCodePoints is NULL, don't exclude any code points.
55 | *
56 | * @param converterList a pointer to encoding names needed to be involved.
57 | * Can be NULL if converterListSize==0.
58 | * The list and the names will be cloned, and the caller
59 | * retains ownership of the original.
60 | * @param converterListSize number of encodings in above list.
61 | * If 0, builds a selector for all available converters.
62 | * @param excludedCodePoints a set of code points to be excluded from consideration.
63 | * That is, excluded code points in a string do not change
64 | * the selection result. (They might be handled by a callback.)
65 | * Use NULL to exclude nothing.
66 | * @param whichSet what converter set to use? Use this to determine whether
67 | * to consider only roundtrip mappings or also fallbacks.
68 | * @param status an in/out ICU UErrorCode
69 | * @return the new selector
70 | *
71 | * @stable ICU 4.2
72 | */
73 | U_STABLE UConverterSelector* U_EXPORT2
74 | ucnvsel_open(const char* const* converterList, int32_t converterListSize,
75 | const USet* excludedCodePoints,
76 | const UConverterUnicodeSet whichSet, UErrorCode* status);
77 |
78 | /**
79 | * Closes a selector.
80 | * If any Enumerations were returned by ucnv_select*, they become invalid.
81 | * They can be closed before or after calling ucnv_closeSelector,
82 | * but should never be used after the selector is closed.
83 | *
84 | * @see ucnv_selectForString
85 | * @see ucnv_selectForUTF8
86 | *
87 | * @param sel selector to close
88 | *
89 | * @stable ICU 4.2
90 | */
91 | U_STABLE void U_EXPORT2
92 | ucnvsel_close(UConverterSelector *sel);
93 |
94 | #if U_SHOW_CPLUSPLUS_API
95 |
96 | U_NAMESPACE_BEGIN
97 |
98 | /**
99 | * \class LocalUConverterSelectorPointer
100 | * "Smart pointer" class, closes a UConverterSelector via ucnvsel_close().
101 | * For most methods see the LocalPointerBase base class.
102 | *
103 | * @see LocalPointerBase
104 | * @see LocalPointer
105 | * @stable ICU 4.4
106 | */
107 | U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterSelectorPointer, UConverterSelector, ucnvsel_close);
108 |
109 | U_NAMESPACE_END
110 |
111 | #endif
112 |
113 | /**
114 | * Open a selector from its serialized form.
115 | * The buffer must remain valid and unchanged for the lifetime of the selector.
116 | * This is much faster than creating a selector from scratch.
117 | * Using a serialized form from a different machine (endianness/charset) is supported.
118 | *
119 | * @param buffer pointer to the serialized form of a converter selector;
120 | * must be 32-bit-aligned
121 | * @param length the capacity of this buffer (can be equal to or larger than
122 | * the actual data length)
123 | * @param status an in/out ICU UErrorCode
124 | * @return the new selector
125 | *
126 | * @stable ICU 4.2
127 | */
128 | U_STABLE UConverterSelector* U_EXPORT2
129 | ucnvsel_openFromSerialized(const void* buffer, int32_t length, UErrorCode* status);
130 |
131 | /**
132 | * Serialize a selector into a linear buffer.
133 | * The serialized form is portable to different machines.
134 | *
135 | * @param sel selector to consider
136 | * @param buffer pointer to 32-bit-aligned memory to be filled with the
137 | * serialized form of this converter selector
138 | * @param bufferCapacity the capacity of this buffer
139 | * @param status an in/out ICU UErrorCode
140 | * @return the required buffer capacity to hold serialize data (even if the call fails
141 | * with a U_BUFFER_OVERFLOW_ERROR, it will return the required capacity)
142 | *
143 | * @stable ICU 4.2
144 | */
145 | U_STABLE int32_t U_EXPORT2
146 | ucnvsel_serialize(const UConverterSelector* sel,
147 | void* buffer, int32_t bufferCapacity, UErrorCode* status);
148 |
149 | /**
150 | * Select converters that can map all characters in a UTF-16 string,
151 | * ignoring the excluded code points.
152 | *
153 | * @param sel a selector
154 | * @param s UTF-16 string
155 | * @param length length of the string, or -1 if NUL-terminated
156 | * @param status an in/out ICU UErrorCode
157 | * @return an enumeration containing encoding names.
158 | * The returned encoding names and their order will be the same as
159 | * supplied when building the selector.
160 | *
161 | * @stable ICU 4.2
162 | */
163 | U_STABLE UEnumeration * U_EXPORT2
164 | ucnvsel_selectForString(const UConverterSelector* sel,
165 | const UChar *s, int32_t length, UErrorCode *status);
166 |
167 | /**
168 | * Select converters that can map all characters in a UTF-8 string,
169 | * ignoring the excluded code points.
170 | *
171 | * @param sel a selector
172 | * @param s UTF-8 string
173 | * @param length length of the string, or -1 if NUL-terminated
174 | * @param status an in/out ICU UErrorCode
175 | * @return an enumeration containing encoding names.
176 | * The returned encoding names and their order will be the same as
177 | * supplied when building the selector.
178 | *
179 | * @stable ICU 4.2
180 | */
181 | U_STABLE UEnumeration * U_EXPORT2
182 | ucnvsel_selectForUTF8(const UConverterSelector* sel,
183 | const char *s, int32_t length, UErrorCode *status);
184 |
185 | #endif /* !UCONFIG_NO_CONVERSION */
186 |
187 | #endif /* __ICU_UCNV_SEL_H__ */
188 |
--------------------------------------------------------------------------------
/3rd/include/icu/unicode/udisplaycontext.h:
--------------------------------------------------------------------------------
1 | /*
2 | *****************************************************************************************
3 | * Copyright (C) 2014, International Business Machines
4 | * Corporation and others. All Rights Reserved.
5 | *****************************************************************************************
6 | */
7 |
8 | #ifndef UDISPLAYCONTEXT_H
9 | #define UDISPLAYCONTEXT_H
10 |
11 | #include "unicode/utypes.h"
12 |
13 | #if !UCONFIG_NO_FORMATTING
14 |
15 | /**
16 | * \file
17 | * \brief C API: Display context types (enum values)
18 | */
19 |
20 | /**
21 | * Display context types, for getting values of a particular setting.
22 | * Note, the specific numeric values are internal and may change.
23 | * @stable ICU 51
24 | */
25 | enum UDisplayContextType {
26 | /**
27 | * Type to retrieve the dialect handling setting, e.g.
28 | * UDISPCTX_STANDARD_NAMES or UDISPCTX_DIALECT_NAMES.
29 | * @stable ICU 51
30 | */
31 | UDISPCTX_TYPE_DIALECT_HANDLING = 0,
32 | /**
33 | * Type to retrieve the capitalization context setting, e.g.
34 | * UDISPCTX_CAPITALIZATION_NONE, UDISPCTX_CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE,
35 | * UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE, etc.
36 | * @stable ICU 51
37 | */
38 | UDISPCTX_TYPE_CAPITALIZATION = 1
39 | #ifndef U_HIDE_DRAFT_API
40 | ,
41 | /**
42 | * Type to retrieve the display length setting, e.g.
43 | * UDISPCTX_LENGTH_FULL, UDISPCTX_LENGTH_SHORT.
44 | * @draft ICU 54
45 | */
46 | UDISPCTX_TYPE_DISPLAY_LENGTH = 2
47 | #endif /* U_HIDE_DRAFT_API */
48 | };
49 | /**
50 | * @stable ICU 51
51 | */
52 | typedef enum UDisplayContextType UDisplayContextType;
53 |
54 | /**
55 | * Display context settings.
56 | * Note, the specific numeric values are internal and may change.
57 | * @stable ICU 51
58 | */
59 | enum UDisplayContext {
60 | /**
61 | * ================================
62 | * DIALECT_HANDLING can be set to one of UDISPCTX_STANDARD_NAMES or
63 | * UDISPCTX_DIALECT_NAMES. Use UDisplayContextType UDISPCTX_TYPE_DIALECT_HANDLING
64 | * to get the value.
65 | */
66 | /**
67 | * A possible setting for DIALECT_HANDLING:
68 | * use standard names when generating a locale name,
69 | * e.g. en_GB displays as 'English (United Kingdom)'.
70 | * @stable ICU 51
71 | */
72 | UDISPCTX_STANDARD_NAMES = (UDISPCTX_TYPE_DIALECT_HANDLING<<8) + 0,
73 | /**
74 | * A possible setting for DIALECT_HANDLING:
75 | * use dialect names, when generating a locale name,
76 | * e.g. en_GB displays as 'British English'.
77 | * @stable ICU 51
78 | */
79 | UDISPCTX_DIALECT_NAMES = (UDISPCTX_TYPE_DIALECT_HANDLING<<8) + 1,
80 | /**
81 | * ================================
82 | * CAPITALIZATION can be set to one of UDISPCTX_CAPITALIZATION_NONE,
83 | * UDISPCTX_CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE,
84 | * UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE,
85 | * UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU, or
86 | * UDISPCTX_CAPITALIZATION_FOR_STANDALONE.
87 | * Use UDisplayContextType UDISPCTX_TYPE_CAPITALIZATION to get the value.
88 | */
89 | /**
90 | * The capitalization context to be used is unknown (this is the default value).
91 | * @stable ICU 51
92 | */
93 | UDISPCTX_CAPITALIZATION_NONE = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 0,
94 | /**
95 | * The capitalization context if a date, date symbol or display name is to be
96 | * formatted with capitalization appropriate for the middle of a sentence.
97 | * @stable ICU 51
98 | */
99 | UDISPCTX_CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 1,
100 | /**
101 | * The capitalization context if a date, date symbol or display name is to be
102 | * formatted with capitalization appropriate for the beginning of a sentence.
103 | * @stable ICU 51
104 | */
105 | UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 2,
106 | /**
107 | * The capitalization context if a date, date symbol or display name is to be
108 | * formatted with capitalization appropriate for a user-interface list or menu item.
109 | * @stable ICU 51
110 | */
111 | UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 3,
112 | /**
113 | * The capitalization context if a date, date symbol or display name is to be
114 | * formatted with capitalization appropriate for stand-alone usage such as an
115 | * isolated name on a calendar page.
116 | * @stable ICU 51
117 | */
118 | UDISPCTX_CAPITALIZATION_FOR_STANDALONE = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 4
119 | #ifndef U_HIDE_DRAFT_API
120 | ,
121 | /**
122 | * ================================
123 | * DISPLAY_LENGTH can be set to one of UDISPCTX_LENGTH_FULL or
124 | * UDISPCTX_LENGTH_SHORT. Use UDisplayContextType UDISPCTX_TYPE_DISPLAY_LENGTH
125 | * to get the value.
126 | */
127 | /**
128 | * A possible setting for DISPLAY_LENGTH:
129 | * use full names when generating a locale name,
130 | * e.g. "United States" for US.
131 | * @draft ICU 54
132 | */
133 | UDISPCTX_LENGTH_FULL = (UDISPCTX_TYPE_DISPLAY_LENGTH<<8) + 0,
134 | /**
135 | * A possible setting for DISPLAY_LENGTH:
136 | * use short names when generating a locale name,
137 | * e.g. "U.S." for US.
138 | * @draft ICU 54
139 | */
140 | UDISPCTX_LENGTH_SHORT = (UDISPCTX_TYPE_DISPLAY_LENGTH<<8) + 1
141 | #endif /* U_HIDE_DRAFT_API */
142 | };
143 | /**
144 | * @stable ICU 51
145 | */
146 | typedef enum UDisplayContext UDisplayContext;
147 |
148 | #endif /* #if !UCONFIG_NO_FORMATTING */
149 |
150 | #endif
151 |
--------------------------------------------------------------------------------
/3rd/include/icu/unicode/ugender.h:
--------------------------------------------------------------------------------
1 | /*
2 | *****************************************************************************************
3 | * Copyright (C) 2010-2013, International Business Machines
4 | * Corporation and others. All Rights Reserved.
5 | *****************************************************************************************
6 | */
7 |
8 | #ifndef UGENDER_H
9 | #define UGENDER_H
10 |
11 | #include "unicode/utypes.h"
12 |
13 | #if !UCONFIG_NO_FORMATTING
14 |
15 | #include "unicode/localpointer.h"
16 |
17 | /**
18 | * \file
19 | * \brief C API: The purpose of this API is to compute the gender of a list as a
20 | * whole given the gender of each element.
21 | *
22 | */
23 |
24 | /**
25 | * Genders
26 | * @stable ICU 50
27 | */
28 | enum UGender {
29 | /**
30 | * Male gender.
31 | * @stable ICU 50
32 | */
33 | UGENDER_MALE,
34 | /**
35 | * Female gender.
36 | * @stable ICU 50
37 | */
38 | UGENDER_FEMALE,
39 | /**
40 | * Neutral gender.
41 | * @stable ICU 50
42 | */
43 | UGENDER_OTHER
44 | };
45 | /**
46 | * @stable ICU 50
47 | */
48 | typedef enum UGender UGender;
49 |
50 | /**
51 | * Opaque UGenderInfo object for use in C programs.
52 | * @stable ICU 50
53 | */
54 | struct UGenderInfo;
55 | typedef struct UGenderInfo UGenderInfo;
56 |
57 | /**
58 | * Opens a new UGenderInfo object given locale.
59 | * @param locale The locale for which the rules are desired.
60 | * @param status UErrorCode pointer
61 | * @return A UGenderInfo for the specified locale, or NULL if an error occurred.
62 | * @stable ICU 50
63 | */
64 | U_STABLE const UGenderInfo* U_EXPORT2
65 | ugender_getInstance(const char *locale, UErrorCode *status);
66 |
67 |
68 | /**
69 | * Given a list, returns the gender of the list as a whole.
70 | * @param genderInfo pointer that ugender_getInstance returns.
71 | * @param genders the gender of each element in the list.
72 | * @param size the size of the list.
73 | * @param status A pointer to a UErrorCode to receive any errors.
74 | * @return The gender of the list.
75 | * @stable ICU 50
76 | */
77 | U_STABLE UGender U_EXPORT2
78 | ugender_getListGender(const UGenderInfo* genderinfo, const UGender *genders, int32_t size, UErrorCode *status);
79 |
80 | #endif /* #if !UCONFIG_NO_FORMATTING */
81 |
82 | #endif
83 |
--------------------------------------------------------------------------------
/3rd/include/icu/unicode/umisc.h:
--------------------------------------------------------------------------------
1 | /*
2 | **********************************************************************
3 | * Copyright (C) 1999-2006, International Business Machines
4 | * Corporation and others. All Rights Reserved.
5 | **********************************************************************
6 | * file name: umisc.h
7 | * encoding: US-ASCII
8 | * tab size: 8 (not used)
9 | * indentation:4
10 | *
11 | * created on: 1999oct15
12 | * created by: Markus W. Scherer
13 | */
14 |
15 | #ifndef UMISC_H
16 | #define UMISC_H
17 |
18 | #include "unicode/utypes.h"
19 |
20 | /**
21 | * \file
22 | * \brief C API:misc definitions
23 | *
24 | * This file contains miscellaneous definitions for the C APIs.
25 | */
26 |
27 | U_CDECL_BEGIN
28 |
29 | /** A struct representing a range of text containing a specific field
30 | * @stable ICU 2.0
31 | */
32 | typedef struct UFieldPosition {
33 | /**
34 | * The field
35 | * @stable ICU 2.0
36 | */
37 | int32_t field;
38 | /**
39 | * The start of the text range containing field
40 | * @stable ICU 2.0
41 | */
42 | int32_t beginIndex;
43 | /**
44 | * The limit of the text range containing field
45 | * @stable ICU 2.0
46 | */
47 | int32_t endIndex;
48 | } UFieldPosition;
49 |
50 | #if !UCONFIG_NO_SERVICE
51 | /**
52 | * Opaque type returned by registerInstance, registerFactory and unregister for service registration.
53 | * @stable ICU 2.6
54 | */
55 | typedef const void* URegistryKey;
56 | #endif
57 |
58 | U_CDECL_END
59 |
60 | #endif
61 |
--------------------------------------------------------------------------------
/3rd/include/icu/unicode/unifilt.h:
--------------------------------------------------------------------------------
1 | /*
2 | **********************************************************************
3 | * Copyright (C) 1999-2010, International Business Machines Corporation and others.
4 | * All Rights Reserved.
5 | **********************************************************************
6 | * Date Name Description
7 | * 11/17/99 aliu Creation.
8 | **********************************************************************
9 | */
10 | #ifndef UNIFILT_H
11 | #define UNIFILT_H
12 |
13 | #include "unicode/unifunct.h"
14 | #include "unicode/unimatch.h"
15 |
16 | /**
17 | * \file
18 | * \brief C++ API: Unicode Filter
19 | */
20 |
21 | U_NAMESPACE_BEGIN
22 |
23 | /**
24 | * U_ETHER is used to represent character values for positions outside
25 | * a range. For example, transliterator uses this to represent
26 | * characters outside the range contextStart..contextLimit-1. This
27 | * allows explicit matching by rules and UnicodeSets of text outside a
28 | * defined range.
29 | * @stable ICU 3.0
30 | */
31 | #define U_ETHER ((UChar)0xFFFF)
32 |
33 | /**
34 | *
35 | * UnicodeFilter
defines a protocol for selecting a
36 | * subset of the full range (U+0000 to U+10FFFF) of Unicode characters.
37 | * Currently, filters are used in conjunction with classes like {@link
38 | * Transliterator} to only process selected characters through a
39 | * transformation.
40 | *
41 | * UnicodeFunctor
is an abstract base class for objects
29 | * that perform match and/or replace operations on Unicode strings.
30 | * @author Alan Liu
31 | * @stable ICU 2.4
32 | */
33 | class U_COMMON_API UnicodeFunctor : public UObject {
34 |
35 | public:
36 |
37 | /**
38 | * Destructor
39 | * @stable ICU 2.4
40 | */
41 | virtual ~UnicodeFunctor();
42 |
43 | /**
44 | * Return a copy of this object. All UnicodeFunctor objects
45 | * have to support cloning in order to allow classes using
46 | * UnicodeFunctor to implement cloning.
47 | * @stable ICU 2.4
48 | */
49 | virtual UnicodeFunctor* clone() const = 0;
50 |
51 | /**
52 | * Cast 'this' to a UnicodeMatcher* pointer and return the
53 | * pointer, or null if this is not a UnicodeMatcher*. Subclasses
54 | * that mix in UnicodeMatcher as a base class must override this.
55 | * This protocol is required because a pointer to a UnicodeFunctor
56 | * cannot be cast to a pointer to a UnicodeMatcher, since
57 | * UnicodeMatcher is a mixin that does not derive from
58 | * UnicodeFunctor.
59 | * @stable ICU 2.4
60 | */
61 | virtual UnicodeMatcher* toMatcher() const;
62 |
63 | /**
64 | * Cast 'this' to a UnicodeReplacer* pointer and return the
65 | * pointer, or null if this is not a UnicodeReplacer*. Subclasses
66 | * that mix in UnicodeReplacer as a base class must override this.
67 | * This protocol is required because a pointer to a UnicodeFunctor
68 | * cannot be cast to a pointer to a UnicodeReplacer, since
69 | * UnicodeReplacer is a mixin that does not derive from
70 | * UnicodeFunctor.
71 | * @stable ICU 2.4
72 | */
73 | virtual UnicodeReplacer* toReplacer() const;
74 |
75 | /**
76 | * Return the class ID for this class. This is useful only for
77 | * comparing to a return value from getDynamicClassID().
78 | * @return The class ID for all objects of this class.
79 | * @stable ICU 2.0
80 | */
81 | static UClassID U_EXPORT2 getStaticClassID(void);
82 |
83 | /**
84 | * Returns a unique class ID polymorphically. This method
85 | * is to implement a simple version of RTTI, since not all C++
86 | * compilers support genuine RTTI. Polymorphic operator==() and
87 | * clone() methods call this method.
88 | *
89 | * UnicodeMatcher::matches()
27 | * indicating the degree of match.
28 | * @stable ICU 2.4
29 | */
30 | enum UMatchDegree {
31 | /**
32 | * Constant returned by matches()
indicating a
33 | * mismatch between the text and this matcher. The text contains
34 | * a character which does not match, or the text does not contain
35 | * all desired characters for a non-incremental match.
36 | * @stable ICU 2.4
37 | */
38 | U_MISMATCH,
39 |
40 | /**
41 | * Constant returned by matches()
indicating a
42 | * partial match between the text and this matcher. This value is
43 | * only returned for incremental match operations. All characters
44 | * of the text match, but more characters are required for a
45 | * complete match. Alternatively, for variable-length matchers,
46 | * all characters of the text match, and if more characters were
47 | * supplied at limit, they might also match.
48 | * @stable ICU 2.4
49 | */
50 | U_PARTIAL_MATCH,
51 |
52 | /**
53 | * Constant returned by matches()
indicating a
54 | * complete match between the text and this matcher. For an
55 | * incremental variable-length match, this value is returned if
56 | * the given text matches, and it is known that additional
57 | * characters would not alter the extent of the match.
58 | * @stable ICU 2.4
59 | */
60 | U_MATCH
61 | };
62 |
63 | /**
64 | * UnicodeMatcher
defines a protocol for objects that can
65 | * match a range of characters in a Replaceable string.
66 | * @stable ICU 2.4
67 | */
68 | class U_COMMON_API UnicodeMatcher /* not : public UObject because this is an interface/mixin class */ {
69 |
70 | public:
71 | /**
72 | * Destructor.
73 | * @stable ICU 2.4
74 | */
75 | virtual ~UnicodeMatcher();
76 |
77 | /**
78 | * Return a UMatchDegree value indicating the degree of match for
79 | * the given text at the given offset. Zero, one, or more
80 | * characters may be matched.
81 | *
82 | * Matching in the forward direction is indicated by limit >
83 | * offset. Characters from offset forwards to limit-1 will be
84 | * considered for matching.
85 | *
86 | * Matching in the reverse direction is indicated by limit <
87 | * offset. Characters from offset backwards to limit+1 will be
88 | * considered for matching.
89 | *
90 | * If limit == offset then the only match possible is a zero
91 | * character match (which subclasses may implement if desired).
92 | *
93 | * As a side effect, advance the offset parameter to the limit of
94 | * the matched substring. In the forward direction, this will be
95 | * the index of the last matched character plus one. In the
96 | * reverse direction, this will be the index of the last matched
97 | * character minus one.
98 | *
99 | * UnicodeReplacer
defines a protocol for objects that
28 | * replace a range of characters in a Replaceable string with output
29 | * text. The replacement is done via the Replaceable API so as to
30 | * preserve out-of-band data.
31 | *
32 | *