Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Side by Side Diff: source/i18n/unicode/alphaindex.h

Issue 845603002: Update ICU to 54.1 step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@master
Patch Set: remove unusued directories Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/i18n/uitercollationiterator.cpp ('k') | source/i18n/unicode/calendar.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 ******************************************************************************* 2 *******************************************************************************
3 * 3 *
4 * Copyright (C) 2011-2013 International Business Machines 4 * Copyright (C) 2011-2014 International Business Machines
5 * Corporation and others. All Rights Reserved. 5 * Corporation and others. All Rights Reserved.
6 * 6 *
7 ******************************************************************************* 7 *******************************************************************************
8 */ 8 */
9 9
10 #ifndef INDEXCHARS_H 10 #ifndef INDEXCHARS_H
11 #define INDEXCHARS_H 11 #define INDEXCHARS_H
12 12
13 #include "unicode/utypes.h" 13 #include "unicode/utypes.h"
14 #include "unicode/uobject.h" 14 #include "unicode/uobject.h"
15 #include "unicode/locid.h" 15 #include "unicode/locid.h"
16 16
17 17 #if !UCONFIG_NO_COLLATION
18 #if !UCONFIG_NO_COLLATION && !UCONFIG_NO_NORMALIZATION
19 18
20 /** 19 /**
21 * \file 20 * \file
22 * \brief C++ API: Index Characters 21 * \brief C++ API: Index Characters
23 */ 22 */
24 23
25 U_CDECL_BEGIN 24 U_CDECL_BEGIN
26 25
27 /** 26 /**
28 * Constants for Alphabetic Index Label Types. 27 * Constants for Alphabetic Index Label Types.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 * </pre> 178 * </pre>
180 * 179 *
181 * <li>The client would put the name (and associated information) into its bucke t for bucketIndex. The sort key sk is a 180 * <li>The client would put the name (and associated information) into its bucke t for bucketIndex. The sort key sk is a
182 * sequence of bytes that can be compared with a binary compare, and produce the right localized result.</li> 181 * sequence of bytes that can be compared with a binary compare, and produce the right localized result.</li>
183 * </ul> 182 * </ul>
184 * 183 *
185 * @stable ICU 4.8 184 * @stable ICU 4.8
186 */ 185 */
187 class U_I18N_API AlphabeticIndex: public UObject { 186 class U_I18N_API AlphabeticIndex: public UObject {
188 public: 187 public:
189 #ifdef U_HIDE_DRAFT_API
190 class Bucket;
191 #else
192 /** 188 /**
193 * An index "bucket" with a label string and type. 189 * An index "bucket" with a label string and type.
194 * It is referenced by getBucketIndex(), 190 * It is referenced by getBucketIndex(),
195 * and returned by ImmutableIndex.getBucket(). 191 * and returned by ImmutableIndex.getBucket().
196 * 192 *
197 * The Bucket class is not intended for public subclassing. 193 * The Bucket class is not intended for public subclassing.
198 * @draft ICU 51 194 * @stable ICU 51
199 */ 195 */
200 class U_I18N_API Bucket : public UObject { 196 class U_I18N_API Bucket : public UObject {
201 public: 197 public:
202 /** 198 /**
203 * Destructor. 199 * Destructor.
204 * @draft ICU 51 200 * @stable ICU 51
205 */ 201 */
206 virtual ~Bucket(); 202 virtual ~Bucket();
207 203
208 /** 204 /**
209 * Returns the label string. 205 * Returns the label string.
210 * 206 *
211 * @return the label string for the bucket 207 * @return the label string for the bucket
212 * @draft ICU 51 208 * @stable ICU 51
213 */ 209 */
214 const UnicodeString &getLabel() const { return label_; } 210 const UnicodeString &getLabel() const { return label_; }
215 /** 211 /**
216 * Returns whether this bucket is a normal, underflow, overflow, or infl ow bucket. 212 * Returns whether this bucket is a normal, underflow, overflow, or infl ow bucket.
217 * 213 *
218 * @return the bucket label type 214 * @return the bucket label type
219 * @draft ICU 51 215 * @stable ICU 51
220 */ 216 */
221 UAlphabeticIndexLabelType getLabelType() const { return labelType_; } 217 UAlphabeticIndexLabelType getLabelType() const { return labelType_; }
222 218
223 private: 219 private:
224 friend class AlphabeticIndex; 220 friend class AlphabeticIndex;
225 friend class BucketList; 221 friend class BucketList;
226 222
227 UnicodeString label_; 223 UnicodeString label_;
228 UnicodeString lowerBoundary_; 224 UnicodeString lowerBoundary_;
229 UAlphabeticIndexLabelType labelType_; 225 UAlphabeticIndexLabelType labelType_;
230 Bucket *displayBucket_; 226 Bucket *displayBucket_;
231 int32_t displayIndex_; 227 int32_t displayIndex_;
232 UVector *records_; // Records are owned by the inputList_ vector. 228 UVector *records_; // Records are owned by the inputList_ vector.
233 229
234 Bucket(const UnicodeString &label, // Parameter strings are copied. 230 Bucket(const UnicodeString &label, // Parameter strings are copied.
235 const UnicodeString &lowerBoundary, 231 const UnicodeString &lowerBoundary,
236 UAlphabeticIndexLabelType type); 232 UAlphabeticIndexLabelType type);
237 }; 233 };
238 234
239 /** 235 /**
240 * Immutable, thread-safe version of AlphabeticIndex. 236 * Immutable, thread-safe version of AlphabeticIndex.
241 * This class provides thread-safe methods for bucketing, 237 * This class provides thread-safe methods for bucketing,
242 * and random access to buckets and their properties, 238 * and random access to buckets and their properties,
243 * but does not offer adding records to the index. 239 * but does not offer adding records to the index.
244 * 240 *
245 * The ImmutableIndex class is not intended for public subclassing. 241 * The ImmutableIndex class is not intended for public subclassing.
246 * 242 *
247 * @draft ICU 51 243 * @stable ICU 51
248 */ 244 */
249 class U_I18N_API ImmutableIndex : public UObject { 245 class U_I18N_API ImmutableIndex : public UObject {
250 public: 246 public:
251 /** 247 /**
252 * Destructor. 248 * Destructor.
253 * @draft ICU 51 249 * @stable ICU 51
254 */ 250 */
255 virtual ~ImmutableIndex(); 251 virtual ~ImmutableIndex();
256 252
257 /** 253 /**
258 * Returns the number of index buckets and labels, including underflow/i nflow/overflow. 254 * Returns the number of index buckets and labels, including underflow/i nflow/overflow.
259 * 255 *
260 * @return the number of index buckets 256 * @return the number of index buckets
261 * @draft ICU 51 257 * @stable ICU 51
262 */ 258 */
263 int32_t getBucketCount() const; 259 int32_t getBucketCount() const;
264 260
265 /** 261 /**
266 * Finds the index bucket for the given name and returns the number of t hat bucket. 262 * Finds the index bucket for the given name and returns the number of t hat bucket.
267 * Use getBucket() to get the bucket's properties. 263 * Use getBucket() to get the bucket's properties.
268 * 264 *
269 * @param name the string to be sorted into an index bucket 265 * @param name the string to be sorted into an index bucket
270 * @return the bucket number for the name 266 * @return the bucket number for the name
271 * @draft ICU 51 267 * @stable ICU 51
272 */ 268 */
273 int32_t getBucketIndex(const UnicodeString &name, UErrorCode &errorCode) const; 269 int32_t getBucketIndex(const UnicodeString &name, UErrorCode &errorCode) const;
274 270
275 /** 271 /**
276 * Returns the index-th bucket. Returns NULL if the index is out of rang e. 272 * Returns the index-th bucket. Returns NULL if the index is out of rang e.
277 * 273 *
278 * @param index bucket number 274 * @param index bucket number
279 * @return the index-th bucket 275 * @return the index-th bucket
280 * @draft ICU 51 276 * @stable ICU 51
281 */ 277 */
282 const Bucket *getBucket(int32_t index) const; 278 const Bucket *getBucket(int32_t index) const;
283 279
284 private: 280 private:
285 friend class AlphabeticIndex; 281 friend class AlphabeticIndex;
286 282
287 ImmutableIndex(BucketList *bucketList, Collator *collatorPrimaryOnly) 283 ImmutableIndex(BucketList *bucketList, Collator *collatorPrimaryOnly)
288 : buckets_(bucketList), collatorPrimaryOnly_(collatorPrimaryOnly ) {} 284 : buckets_(bucketList), collatorPrimaryOnly_(collatorPrimaryOnly ) {}
289 285
290 BucketList *buckets_; 286 BucketList *buckets_;
291 Collator *collatorPrimaryOnly_; 287 Collator *collatorPrimaryOnly_;
292 }; 288 };
293 #endif /* U_HIDE_DRAFT_API */
294 289
295 /** 290 /**
296 * Construct an AlphabeticIndex object for the specified locale. If the loc ale's 291 * Construct an AlphabeticIndex object for the specified locale. If the loc ale's
297 * data does not include index characters, a set of them will be 292 * data does not include index characters, a set of them will be
298 * synthesized based on the locale's exemplar characters. The locale 293 * synthesized based on the locale's exemplar characters. The locale
299 * determines the sorting order for both the index characters and the 294 * determines the sorting order for both the index characters and the
300 * user item names appearing under each Index character. 295 * user item names appearing under each Index character.
301 * 296 *
302 * @param locale the desired locale. 297 * @param locale the desired locale.
303 * @param status Error code, will be set with the reason if the construction 298 * @param status Error code, will be set with the reason if the construction
304 * of the AlphabeticIndex object fails. 299 * of the AlphabeticIndex object fails.
305 * @stable ICU 4.8 300 * @stable ICU 4.8
306 */ 301 */
307 AlphabeticIndex(const Locale &locale, UErrorCode &status); 302 AlphabeticIndex(const Locale &locale, UErrorCode &status);
308 303
309 #ifndef U_HIDE_DRAFT_API
310 /** 304 /**
311 * Construct an AlphabeticIndex that uses a specific collator. 305 * Construct an AlphabeticIndex that uses a specific collator.
312 * 306 *
313 * The index will be created with no labels; the addLabels() function must b e called 307 * The index will be created with no labels; the addLabels() function must b e called
314 * after creation to add the desired labels to the index. 308 * after creation to add the desired labels to the index.
315 * 309 *
316 * The index adopts the collator, and is responsible for deleting it. 310 * The index adopts the collator, and is responsible for deleting it.
317 * The caller should make no further use of the collator after creating the index. 311 * The caller should make no further use of the collator after creating the index.
318 * 312 *
319 * @param collator The collator to use to order the contents of this index. 313 * @param collator The collator to use to order the contents of this index.
320 * @param status Error code, will be set with the reason if the 314 * @param status Error code, will be set with the reason if the
321 * operation fails. 315 * operation fails.
322 * @draft ICU 51 316 * @stable ICU 51
323 */ 317 */
324 AlphabeticIndex(RuleBasedCollator *collator, UErrorCode &status); 318 AlphabeticIndex(RuleBasedCollator *collator, UErrorCode &status);
325 #endif /* U_HIDE_DRAFT_API */
326 319
327 /** 320 /**
328 * Add Labels to this Index. The labels are additions to those 321 * Add Labels to this Index. The labels are additions to those
329 * that are already in the index; they do not replace the existing 322 * that are already in the index; they do not replace the existing
330 * ones. 323 * ones.
331 * @param additions The additional characters to add to the index, such as A -Z. 324 * @param additions The additional characters to add to the index, such as A -Z.
332 * @param status Error code, will be set with the reason if the 325 * @param status Error code, will be set with the reason if the
333 * operation fails. 326 * operation fails.
334 * @return this, for chaining 327 * @return this, for chaining
335 * @stable ICU 4.8 328 * @stable ICU 4.8
(...skipping 14 matching lines...) Expand all
350 * @stable ICU 4.8 343 * @stable ICU 4.8
351 */ 344 */
352 virtual AlphabeticIndex &addLabels(const Locale &locale, UErrorCode &status) ; 345 virtual AlphabeticIndex &addLabels(const Locale &locale, UErrorCode &status) ;
353 346
354 /** 347 /**
355 * Destructor 348 * Destructor
356 * @stable ICU 4.8 349 * @stable ICU 4.8
357 */ 350 */
358 virtual ~AlphabeticIndex(); 351 virtual ~AlphabeticIndex();
359 352
360 #ifndef U_HIDE_DRAFT_API
361 /** 353 /**
362 * Builds an immutable, thread-safe version of this instance, without data r ecords. 354 * Builds an immutable, thread-safe version of this instance, without data r ecords.
363 * 355 *
364 * @return an immutable index instance 356 * @return an immutable index instance
365 * @draft ICU 51 357 * @stable ICU 51
366 */ 358 */
367 ImmutableIndex *buildImmutableIndex(UErrorCode &errorCode); 359 ImmutableIndex *buildImmutableIndex(UErrorCode &errorCode);
368 #endif /* U_HIDE_DRAFT_API */
369 360
370 /** 361 /**
371 * Get the Collator that establishes the ordering of the items in this index . 362 * Get the Collator that establishes the ordering of the items in this index .
372 * Ownership of the collator remains with the AlphabeticIndex instance. 363 * Ownership of the collator remains with the AlphabeticIndex instance.
373 * 364 *
374 * The returned collator is a reference to the internal collator used by thi s 365 * The returned collator is a reference to the internal collator used by thi s
375 * index. It may be safely used to compare the names of items or to get 366 * index. It may be safely used to compare the names of items or to get
376 * sort keys for names. However if any settings need to be changed, 367 * sort keys for names. However if any settings need to be changed,
377 * or other non-const methods called, a cloned copy must be made first. 368 * or other non-const methods called, a cloned copy must be made first.
378 * 369 *
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 UnicodeString inflowLabel_; 741 UnicodeString inflowLabel_;
751 UnicodeString overflowLabel_; 742 UnicodeString overflowLabel_;
752 UnicodeString underflowLabel_; 743 UnicodeString underflowLabel_;
753 UnicodeString overflowComparisonString_; 744 UnicodeString overflowComparisonString_;
754 745
755 UnicodeString emptyString_; 746 UnicodeString emptyString_;
756 }; 747 };
757 748
758 U_NAMESPACE_END 749 U_NAMESPACE_END
759 750
760 #endif /* UCONFIG_NO_COLLATION / UCONFIG_NO_NORMALIZATION */ 751 #endif // !UCONFIG_NO_COLLATION
761 #endif 752 #endif
OLDNEW
« no previous file with comments | « source/i18n/uitercollationiterator.cpp ('k') | source/i18n/unicode/calendar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698