1 // © 2016 and later: Unicode, Inc. and others. 2 // License & terms of use: http://www.unicode.org/copyright.html 3 /* 4 ******************************************************************************* 5 * 6 * Copyright (C) 2011-2014 International Business Machines 7 * Corporation and others. All Rights Reserved. 8 * 9 ******************************************************************************* 10 */ 11 12 #ifndef INDEXCHARS_H 13 #define INDEXCHARS_H 14 15 #include "unicode/utypes.h" 16 #include "unicode/uobject.h" 17 #include "unicode/locid.h" 18 #include "unicode/unistr.h" 19 20 #if !UCONFIG_NO_COLLATION 21 22 /** 23 * \file 24 * \brief C++ API: Index Characters 25 */ 26 27 U_CDECL_BEGIN 28 29 /** 30 * Constants for Alphabetic Index Label Types. 31 * The form of these enum constants anticipates having a plain C API 32 * for Alphabetic Indexes that will also use them. 33 * @stable ICU 4.8 34 */ 35 typedef enum UAlphabeticIndexLabelType { 36 /** 37 * Normal Label, typically the starting letter of the names 38 * in the bucket with this label. 39 * @stable ICU 4.8 40 */ 41 U_ALPHAINDEX_NORMAL = 0, 42 43 /** 44 * Undeflow Label. The bucket with this label contains names 45 * in scripts that sort before any of the bucket labels in this index. 46 * @stable ICU 4.8 47 */ 48 U_ALPHAINDEX_UNDERFLOW = 1, 49 50 /** 51 * Inflow Label. The bucket with this label contains names 52 * in scripts that sort between two of the bucket labels in this index. 53 * Inflow labels are created when an index contains normal labels for 54 * multiple scripts, and skips other scripts that sort between some of the 55 * included scripts. 56 * @stable ICU 4.8 57 */ 58 U_ALPHAINDEX_INFLOW = 2, 59 60 /** 61 * Overflow Label. Te bucket with this label contains names in scripts 62 * that sort after all of the bucket labels in this index. 63 * @stable ICU 4.8 64 */ 65 U_ALPHAINDEX_OVERFLOW = 3 66 } UAlphabeticIndexLabelType; 67 68 69 struct UHashtable; 70 U_CDECL_END 71 72 U_NAMESPACE_BEGIN 73 74 // Forward Declarations 75 76 class BucketList; 77 class Collator; 78 class RuleBasedCollator; 79 class StringEnumeration; 80 class UnicodeSet; 81 class UVector; 82 83 /** 84 * AlphabeticIndex supports the creation of a UI index appropriate for a given language. 85 * It can support either direct use, or use with a client that doesn't support localized collation. 86 * The following is an example of what an index might look like in a UI: 87 * 88 * <pre> 89 * <b>... A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ...</b> 90 * 91 * <b>A</b> 92 * Addison 93 * Albertson 94 * Azensky 95 * <b>B</b> 96 * Baker 97 * ... 98 * </pre> 99 * 100 * The class can generate a list of labels for use as a UI "index", that is, a list of 101 * clickable characters (or character sequences) that allow the user to see a segment 102 * (bucket) of a larger "target" list. That is, each label corresponds to a bucket in 103 * the target list, where everything in the bucket is greater than or equal to the character 104 * (according to the locale's collation). Strings can be added to the index; 105 * they will be in sorted order in the right bucket. 106 * <p> 107 * The class also supports having buckets for strings before the first (underflow), 108 * after the last (overflow), and between scripts (inflow). For example, if the index 109 * is constructed with labels for Russian and English, Greek characters would fall 110 * into an inflow bucket between the other two scripts. 111 * <p> 112 * The AlphabeticIndex class is not intended for public subclassing. 113 * 114 * <p><em>Note:</em> If you expect to have a lot of ASCII or Latin characters 115 * as well as characters from the user's language, 116 * then it is a good idea to call addLabels(Locale::getEnglish(), status).</p> 117 * 118 * <h2>Direct Use</h2> 119 * <p>The following shows an example of building an index directly. 120 * The "show..." methods below are just to illustrate usage. 121 * 122 * <pre> 123 * // Create a simple index. "Item" is assumed to be an application 124 * // defined type that the application's UI and other processing knows about, 125 * // and that has a name. 126 * 127 * UErrorCode status = U_ZERO_ERROR; 128 * AlphabeticIndex index = new AlphabeticIndex(desiredLocale, status); 129 * index->addLabels(additionalLocale, status); 130 * for (Item *item in some source of Items ) { 131 * index->addRecord(item->name(), item, status); 132 * } 133 * ... 134 * // Show index at top. We could skip or gray out empty buckets 135 * 136 * while (index->nextBucket(status)) { 137 * if (showAll || index->getBucketRecordCount() != 0) { 138 * showLabelAtTop(UI, index->getBucketLabel()); 139 * } 140 * } 141 * ... 142 * // Show the buckets with their contents, skipping empty buckets 143 * 144 * index->resetBucketIterator(status); 145 * while (index->nextBucket(status)) { 146 * if (index->getBucketRecordCount() != 0) { 147 * showLabelInList(UI, index->getBucketLabel()); 148 * while (index->nextRecord(status)) { 149 * showIndexedItem(UI, static_cast<Item *>(index->getRecordData())) 150 * </pre> 151 * 152 * The caller can build different UIs using this class. 153 * For example, an index character could be omitted or grayed-out 154 * if its bucket is empty. Small buckets could also be combined based on size, such as: 155 * 156 * <pre> 157 * <b>... A-F G-N O-Z ...</b> 158 * </pre> 159 * 160 * <h2>Client Support</h2> 161 * <p>Callers can also use the AlphabeticIndex::ImmutableIndex, or the AlphabeticIndex itself, 162 * to support sorting on a client that doesn't support AlphabeticIndex functionality. 163 * 164 * <p>The ImmutableIndex is both immutable and thread-safe. 165 * The corresponding AlphabeticIndex methods are not thread-safe because 166 * they "lazily" build the index buckets. 167 * <ul> 168 * <li>ImmutableIndex.getBucket(index) provides random access to all 169 * buckets and their labels and label types. 170 * <li>The AlphabeticIndex bucket iterator or ImmutableIndex.getBucket(0..getBucketCount-1) 171 * can be used to get a list of the labels, 172 * such as "...", "A", "B",..., and send that list to the client. 173 * <li>When the client has a new name, it sends that name to the server. 174 * The server needs to call the following methods, 175 * and communicate the bucketIndex and collationKey back to the client. 176 * 177 * <pre> 178 * int32_t bucketIndex = index.getBucketIndex(name, status); 179 * const UnicodeString &label = immutableIndex.getBucket(bucketIndex)->getLabel(); // optional 180 * int32_t skLength = collator.getSortKey(name, sk, skCapacity); 181 * </pre> 182 * 183 * <li>The client would put the name (and associated information) into its bucket for bucketIndex. The sort key sk is a 184 * sequence of bytes that can be compared with a binary compare, and produce the right localized result.</li> 185 * </ul> 186 * 187 * @stable ICU 4.8 188 */ 189 class U_I18N_API AlphabeticIndex: public UObject { 190 public: 191 /** 192 * An index "bucket" with a label string and type. 193 * It is referenced by getBucketIndex(), 194 * and returned by ImmutableIndex.getBucket(). 195 * 196 * The Bucket class is not intended for public subclassing. 197 * @stable ICU 51 198 */ 199 class U_I18N_API Bucket : public UObject { 200 public: 201 /** 202 * Destructor. 203 * @stable ICU 51 204 */ 205 virtual ~Bucket(); 206 207 /** 208 * Returns the label string. 209 * 210 * @return the label string for the bucket 211 * @stable ICU 51 212 */ getLabel()213 const UnicodeString &getLabel() const { return label_; } 214 /** 215 * Returns whether this bucket is a normal, underflow, overflow, or inflow bucket. 216 * 217 * @return the bucket label type 218 * @stable ICU 51 219 */ getLabelType()220 UAlphabeticIndexLabelType getLabelType() const { return labelType_; } 221 222 private: 223 friend class AlphabeticIndex; 224 friend class BucketList; 225 226 UnicodeString label_; 227 UnicodeString lowerBoundary_; 228 UAlphabeticIndexLabelType labelType_; 229 Bucket *displayBucket_; 230 int32_t displayIndex_; 231 UVector *records_; // Records are owned by the inputList_ vector. 232 233 Bucket(const UnicodeString &label, // Parameter strings are copied. 234 const UnicodeString &lowerBoundary, 235 UAlphabeticIndexLabelType type); 236 }; 237 238 /** 239 * Immutable, thread-safe version of AlphabeticIndex. 240 * This class provides thread-safe methods for bucketing, 241 * and random access to buckets and their properties, 242 * but does not offer adding records to the index. 243 * 244 * The ImmutableIndex class is not intended for public subclassing. 245 * 246 * @stable ICU 51 247 */ 248 class U_I18N_API ImmutableIndex : public UObject { 249 public: 250 /** 251 * Destructor. 252 * @stable ICU 51 253 */ 254 virtual ~ImmutableIndex(); 255 256 /** 257 * Returns the number of index buckets and labels, including underflow/inflow/overflow. 258 * 259 * @return the number of index buckets 260 * @stable ICU 51 261 */ 262 int32_t getBucketCount() const; 263 264 /** 265 * Finds the index bucket for the given name and returns the number of that bucket. 266 * Use getBucket() to get the bucket's properties. 267 * 268 * @param name the string to be sorted into an index bucket 269 * @param errorCode Error code, will be set with the reason if the 270 * operation fails. 271 * @return the bucket number for the name 272 * @stable ICU 51 273 */ 274 int32_t getBucketIndex(const UnicodeString &name, UErrorCode &errorCode) const; 275 276 /** 277 * Returns the index-th bucket. Returns NULL if the index is out of range. 278 * 279 * @param index bucket number 280 * @return the index-th bucket 281 * @stable ICU 51 282 */ 283 const Bucket *getBucket(int32_t index) const; 284 285 private: 286 friend class AlphabeticIndex; 287 ImmutableIndex(BucketList * bucketList,Collator * collatorPrimaryOnly)288 ImmutableIndex(BucketList *bucketList, Collator *collatorPrimaryOnly) 289 : buckets_(bucketList), collatorPrimaryOnly_(collatorPrimaryOnly) {} 290 291 BucketList *buckets_; 292 Collator *collatorPrimaryOnly_; 293 }; 294 295 /** 296 * Construct an AlphabeticIndex object for the specified locale. If the locale's 297 * data does not include index characters, a set of them will be 298 * synthesized based on the locale's exemplar characters. The locale 299 * determines the sorting order for both the index characters and the 300 * user item names appearing under each Index character. 301 * 302 * @param locale the desired locale. 303 * @param status Error code, will be set with the reason if the construction 304 * of the AlphabeticIndex object fails. 305 * @stable ICU 4.8 306 */ 307 AlphabeticIndex(const Locale &locale, UErrorCode &status); 308 309 /** 310 * Construct an AlphabeticIndex that uses a specific collator. 311 * 312 * The index will be created with no labels; the addLabels() function must be called 313 * after creation to add the desired labels to the index. 314 * 315 * The index adopts the collator, and is responsible for deleting it. 316 * The caller should make no further use of the collator after creating the index. 317 * 318 * @param collator The collator to use to order the contents of this index. 319 * @param status Error code, will be set with the reason if the 320 * operation fails. 321 * @stable ICU 51 322 */ 323 AlphabeticIndex(RuleBasedCollator *collator, UErrorCode &status); 324 325 /** 326 * Add Labels to this Index. The labels are additions to those 327 * that are already in the index; they do not replace the existing 328 * ones. 329 * @param additions The additional characters to add to the index, such as A-Z. 330 * @param status Error code, will be set with the reason if the 331 * operation fails. 332 * @return this, for chaining 333 * @stable ICU 4.8 334 */ 335 virtual AlphabeticIndex &addLabels(const UnicodeSet &additions, UErrorCode &status); 336 337 /** 338 * Add the index characters from a Locale to the index. The labels 339 * are added to those that are already in the index; they do not replace the 340 * existing index characters. The collation order for this index is not 341 * changed; it remains that of the locale that was originally specified 342 * when creating this Index. 343 * 344 * @param locale The locale whose index characters are to be added. 345 * @param status Error code, will be set with the reason if the 346 * operation fails. 347 * @return this, for chaining 348 * @stable ICU 4.8 349 */ 350 virtual AlphabeticIndex &addLabels(const Locale &locale, UErrorCode &status); 351 352 /** 353 * Destructor 354 * @stable ICU 4.8 355 */ 356 virtual ~AlphabeticIndex(); 357 358 /** 359 * Builds an immutable, thread-safe version of this instance, without data records. 360 * 361 * @return an immutable index instance 362 * @stable ICU 51 363 */ 364 ImmutableIndex *buildImmutableIndex(UErrorCode &errorCode); 365 366 /** 367 * Get the Collator that establishes the ordering of the items in this index. 368 * Ownership of the collator remains with the AlphabeticIndex instance. 369 * 370 * The returned collator is a reference to the internal collator used by this 371 * index. It may be safely used to compare the names of items or to get 372 * sort keys for names. However if any settings need to be changed, 373 * or other non-const methods called, a cloned copy must be made first. 374 * 375 * @return The collator 376 * @stable ICU 4.8 377 */ 378 virtual const RuleBasedCollator &getCollator() const; 379 380 381 /** 382 * Get the default label used for abbreviated buckets *between* other index characters. 383 * For example, consider the labels when Latin (X Y Z) and Greek (Α Β Γ) are used: 384 * 385 * X Y Z ... Α Β Γ. 386 * 387 * @return inflow label 388 * @stable ICU 4.8 389 */ 390 virtual const UnicodeString &getInflowLabel() const; 391 392 /** 393 * Set the default label used for abbreviated buckets <i>between</i> other index characters. 394 * An inflow label will be automatically inserted if two otherwise-adjacent label characters 395 * are from different scripts, e.g. Latin and Cyrillic, and a third script, e.g. Greek, 396 * sorts between the two. The default inflow character is an ellipsis (...) 397 * 398 * @param inflowLabel the new Inflow label. 399 * @param status Error code, will be set with the reason if the operation fails. 400 * @return this 401 * @stable ICU 4.8 402 */ 403 virtual AlphabeticIndex &setInflowLabel(const UnicodeString &inflowLabel, UErrorCode &status); 404 405 406 /** 407 * Get the special label used for items that sort after the last normal label, 408 * and that would not otherwise have an appropriate label. 409 * 410 * @return the overflow label 411 * @stable ICU 4.8 412 */ 413 virtual const UnicodeString &getOverflowLabel() const; 414 415 416 /** 417 * Set the label used for items that sort after the last normal label, 418 * and that would not otherwise have an appropriate label. 419 * 420 * @param overflowLabel the new overflow label. 421 * @param status Error code, will be set with the reason if the operation fails. 422 * @return this 423 * @stable ICU 4.8 424 */ 425 virtual AlphabeticIndex &setOverflowLabel(const UnicodeString &overflowLabel, UErrorCode &status); 426 427 /** 428 * Get the special label used for items that sort before the first normal label, 429 * and that would not otherwise have an appropriate label. 430 * 431 * @return underflow label 432 * @stable ICU 4.8 433 */ 434 virtual const UnicodeString &getUnderflowLabel() const; 435 436 /** 437 * Set the label used for items that sort before the first normal label, 438 * and that would not otherwise have an appropriate label. 439 * 440 * @param underflowLabel the new underflow label. 441 * @param status Error code, will be set with the reason if the operation fails. 442 * @return this 443 * @stable ICU 4.8 444 */ 445 virtual AlphabeticIndex &setUnderflowLabel(const UnicodeString &underflowLabel, UErrorCode &status); 446 447 448 /** 449 * Get the limit on the number of labels permitted in the index. 450 * The number does not include over, under and inflow labels. 451 * 452 * @return maxLabelCount maximum number of labels. 453 * @stable ICU 4.8 454 */ 455 virtual int32_t getMaxLabelCount() const; 456 457 /** 458 * Set a limit on the number of labels permitted in the index. 459 * The number does not include over, under and inflow labels. 460 * Currently, if the number is exceeded, then every 461 * nth item is removed to bring the count down. 462 * A more sophisticated mechanism may be available in the future. 463 * 464 * @param maxLabelCount the maximum number of labels. 465 * @param status error code 466 * @return This, for chaining 467 * @stable ICU 4.8 468 */ 469 virtual AlphabeticIndex &setMaxLabelCount(int32_t maxLabelCount, UErrorCode &status); 470 471 472 /** 473 * Add a record to the index. Each record will be associated with an index Bucket 474 * based on the record's name. The list of records for each bucket will be sorted 475 * based on the collation ordering of the names in the index's locale. 476 * Records with duplicate names are permitted; they will be kept in the order 477 * that they were added. 478 * 479 * @param name The display name for the Record. The Record will be placed in 480 * a bucket based on this name. 481 * @param data An optional pointer to user data associated with this 482 * item. When iterating the contents of a bucket, both the 483 * data pointer the name will be available for each Record. 484 * @param status Error code, will be set with the reason if the operation fails. 485 * @return This, for chaining. 486 * @stable ICU 4.8 487 */ 488 virtual AlphabeticIndex &addRecord(const UnicodeString &name, const void *data, UErrorCode &status); 489 490 /** 491 * Remove all Records from the Index. The set of Buckets, which define the headings under 492 * which records are classified, is not altered. 493 * 494 * @param status Error code, will be set with the reason if the operation fails. 495 * @return This, for chaining. 496 * @stable ICU 4.8 497 */ 498 virtual AlphabeticIndex &clearRecords(UErrorCode &status); 499 500 501 /** Get the number of labels in this index. 502 * Note: may trigger lazy index construction. 503 * 504 * @param status Error code, will be set with the reason if the operation fails. 505 * @return The number of labels in this index, including any under, over or 506 * in-flow labels. 507 * @stable ICU 4.8 508 */ 509 virtual int32_t getBucketCount(UErrorCode &status); 510 511 512 /** Get the total number of Records in this index, that is, the number 513 * of <name, data> pairs added. 514 * 515 * @param status Error code, will be set with the reason if the operation fails. 516 * @return The number of records in this index, that is, the total number 517 * of (name, data) items added with addRecord(). 518 * @stable ICU 4.8 519 */ 520 virtual int32_t getRecordCount(UErrorCode &status); 521 522 523 524 /** 525 * Given the name of a record, return the zero-based index of the Bucket 526 * in which the item should appear. The name need not be in the index. 527 * A Record will not be added to the index by this function. 528 * Bucket numbers are zero-based, in Bucket iteration order. 529 * 530 * @param itemName The name whose bucket position in the index is to be determined. 531 * @param status Error code, will be set with the reason if the operation fails. 532 * @return The bucket number for this name. 533 * @stable ICU 4.8 534 * 535 */ 536 virtual int32_t getBucketIndex(const UnicodeString &itemName, UErrorCode &status); 537 538 539 /** 540 * Get the zero based index of the current Bucket from an iteration 541 * over the Buckets of this index. Return -1 if no iteration is in process. 542 * @return the index of the current Bucket 543 * @stable ICU 4.8 544 */ 545 virtual int32_t getBucketIndex() const; 546 547 548 /** 549 * Advance the iteration over the Buckets of this index. Return FALSE if 550 * there are no more Buckets. 551 * 552 * @param status Error code, will be set with the reason if the operation fails. 553 * U_ENUM_OUT_OF_SYNC_ERROR will be reported if the index is modified while 554 * an enumeration of its contents are in process. 555 * 556 * @return TRUE if success, FALSE if at end of iteration 557 * @stable ICU 4.8 558 */ 559 virtual UBool nextBucket(UErrorCode &status); 560 561 /** 562 * Return the name of the Label of the current bucket from an iteration over the buckets. 563 * If the iteration is before the first Bucket (nextBucket() has not been called), 564 * or after the last, return an empty string. 565 * 566 * @return the bucket label. 567 * @stable ICU 4.8 568 */ 569 virtual const UnicodeString &getBucketLabel() const; 570 571 /** 572 * Return the type of the label for the current Bucket (selected by the 573 * iteration over Buckets.) 574 * 575 * @return the label type. 576 * @stable ICU 4.8 577 */ 578 virtual UAlphabeticIndexLabelType getBucketLabelType() const; 579 580 /** 581 * Get the number of <name, data> Records in the current Bucket. 582 * If the current bucket iteration position is before the first label or after the 583 * last, return 0. 584 * 585 * @return the number of Records. 586 * @stable ICU 4.8 587 */ 588 virtual int32_t getBucketRecordCount() const; 589 590 591 /** 592 * Reset the Bucket iteration for this index. The next call to nextBucket() 593 * will restart the iteration at the first label. 594 * 595 * @param status Error code, will be set with the reason if the operation fails. 596 * @return this, for chaining. 597 * @stable ICU 4.8 598 */ 599 virtual AlphabeticIndex &resetBucketIterator(UErrorCode &status); 600 601 /** 602 * Advance to the next record in the current Bucket. 603 * When nextBucket() is called, Record iteration is reset to just before the 604 * first Record in the new Bucket. 605 * 606 * @param status Error code, will be set with the reason if the operation fails. 607 * U_ENUM_OUT_OF_SYNC_ERROR will be reported if the index is modified while 608 * an enumeration of its contents are in process. 609 * @return TRUE if successful, FALSE when the iteration advances past the last item. 610 * @stable ICU 4.8 611 */ 612 virtual UBool nextRecord(UErrorCode &status); 613 614 /** 615 * Get the name of the current Record. 616 * Return an empty string if the Record iteration position is before first 617 * or after the last. 618 * 619 * @return The name of the current index item. 620 * @stable ICU 4.8 621 */ 622 virtual const UnicodeString &getRecordName() const; 623 624 625 /** 626 * Return the data pointer of the Record currently being iterated over. 627 * Return NULL if the current iteration position before the first item in this Bucket, 628 * or after the last. 629 * 630 * @return The current Record's data pointer. 631 * @stable ICU 4.8 632 */ 633 virtual const void *getRecordData() const; 634 635 636 /** 637 * Reset the Record iterator position to before the first Record in the current Bucket. 638 * 639 * @return This, for chaining. 640 * @stable ICU 4.8 641 */ 642 virtual AlphabeticIndex &resetRecordIterator(); 643 644 private: 645 /** 646 * No Copy constructor. 647 * @internal 648 */ 649 AlphabeticIndex(const AlphabeticIndex &other); 650 651 /** 652 * No assignment. 653 */ 654 AlphabeticIndex &operator =(const AlphabeticIndex & /*other*/) { return *this;}; 655 656 /** 657 * No Equality operators. 658 * @internal 659 */ 660 virtual UBool operator==(const AlphabeticIndex& other) const; 661 662 /** 663 * Inequality operator. 664 * @internal 665 */ 666 virtual UBool operator!=(const AlphabeticIndex& other) const; 667 668 // Common initialization, for use from all constructors. 669 void init(const Locale *locale, UErrorCode &status); 670 671 /** 672 * This method is called to get the index exemplars. Normally these come from the locale directly, 673 * but if they aren't available, we have to synthesize them. 674 */ 675 void addIndexExemplars(const Locale &locale, UErrorCode &status); 676 /** 677 * Add Chinese index characters from the tailoring. 678 */ 679 UBool addChineseIndexCharacters(UErrorCode &errorCode); 680 681 UVector *firstStringsInScript(UErrorCode &status); 682 683 static UnicodeString separated(const UnicodeString &item); 684 685 /** 686 * Determine the best labels to use. 687 * This is based on the exemplars, but we also process to make sure that they are unique, 688 * and sort differently, and that the overall list is small enough. 689 */ 690 void initLabels(UVector &indexCharacters, UErrorCode &errorCode) const; 691 BucketList *createBucketList(UErrorCode &errorCode) const; 692 void initBuckets(UErrorCode &errorCode); 693 void clearBuckets(); 694 void internalResetBucketIterator(); 695 696 public: 697 698 // The Record is declared public only to allow access from 699 // implementation code written in plain C. 700 // It is not intended for public use. 701 702 #ifndef U_HIDE_INTERNAL_API 703 /** 704 * A (name, data) pair, to be sorted by name into one of the index buckets. 705 * The user data is not used by the index implementation. 706 * \cond 707 * @internal 708 */ 709 struct Record: public UMemory { 710 const UnicodeString name_; 711 const void *data_; 712 Record(const UnicodeString &name, const void *data); 713 ~Record(); 714 }; 715 /** \endcond */ 716 #endif /* U_HIDE_INTERNAL_API */ 717 718 private: 719 720 /** 721 * Holds all user records before they are distributed into buckets. 722 * Type of contents is (Record *) 723 * @internal 724 */ 725 UVector *inputList_; 726 727 int32_t labelsIterIndex_; // Index of next item to return. 728 int32_t itemsIterIndex_; 729 Bucket *currentBucket_; // While an iteration of the index in underway, 730 // point to the bucket for the current label. 731 // NULL when no iteration underway. 732 733 int32_t maxLabelCount_; // Limit on # of labels permitted in the index. 734 735 UnicodeSet *initialLabels_; // Initial (unprocessed) set of Labels. Union 736 // of those explicitly set by the user plus 737 // those from locales. Raw values, before 738 // crunching into bucket labels. 739 740 UVector *firstCharsInScripts_; // The first character from each script, 741 // in collation order. 742 743 RuleBasedCollator *collator_; 744 RuleBasedCollator *collatorPrimaryOnly_; 745 746 // Lazy evaluated: null means that we have not built yet. 747 BucketList *buckets_; 748 749 UnicodeString inflowLabel_; 750 UnicodeString overflowLabel_; 751 UnicodeString underflowLabel_; 752 UnicodeString overflowComparisonString_; 753 754 UnicodeString emptyString_; 755 }; 756 757 U_NAMESPACE_END 758 759 #endif // !UCONFIG_NO_COLLATION 760 #endif 761