MediaWiki  master
CustomUppercaseCollation Class Reference

Resort normal UTF-8 order by putting a bunch of stuff in PUA. More...

Inheritance diagram for CustomUppercaseCollation:
Collaboration diagram for CustomUppercaseCollation:

Public Member Functions

 __construct (array $alphabet, Language $lang)
 getFirstLetter ( $string)
 getSortKey ( $string)
- Public Member Functions inherited from NumericUppercaseCollation
 __construct (Language $lang)
 getFirstLetter ( $string)
 getSortKey ( $string)
- Public Member Functions inherited from UppercaseCollation
 __construct ()
 getFirstLetter ( $string)
 getSortKey ( $string)
- Public Member Functions inherited from Collation
 getFirstLetter ( $string)
 Given a string, return the logical "first letter" to be used for grouping on category pages and so on. More...
 getSortKey ( $string)
 Given a string, convert it to a (hopefully short) key that can be used for efficient sorting. More...

Private Member Functions

 convertToPua ( $string)

Private Attributes

array $firstLetters

Additional Inherited Members

- Static Public Member Functions inherited from Collation
static factory ( $collationName)
static singleton ()

Detailed Description

Resort normal UTF-8 order by putting a bunch of stuff in PUA.

This takes a bunch of characters (The alphabet) that should, be together, and converts them all to private-use-area characters so that they are all sorted in the right order relative to each other.

This renumbers characters starting at U+F3000 (Chosen to avoid conflicts with other people using private use area)

This does not support fancy things like secondary differences, etc. (It supports digraphs, trigraphs etc. though.)

It is expected most people will subclass this and just override the constructor to hard-code an alphabet.

Definition at line 40 of file CustomUppercaseCollation.php.

Constructor & Destructor Documentation

◆ __construct()

CustomUppercaseCollation::__construct ( array  $alphabet,
Language  $lang 
This assumes $alphabet does not contain U+F3000-U+F3FFF
array$alphabetSorted array of uppercase characters.
Language$langWhat language for number sorting.

Definition at line 57 of file CustomUppercaseCollation.php.

References $alphabet.

Member Function Documentation

◆ convertToPua()

CustomUppercaseCollation::convertToPua (   $string)

Definition at line 79 of file CustomUppercaseCollation.php.

Referenced by getSortKey().

◆ getFirstLetter()

CustomUppercaseCollation::getFirstLetter (   $string)

Definition at line 87 of file CustomUppercaseCollation.php.

References getSortKey().

◆ getSortKey()

CustomUppercaseCollation::getSortKey (   $string)

Definition at line 83 of file CustomUppercaseCollation.php.

References convertToPua().

Referenced by getFirstLetter().

Member Data Documentation

◆ $alphabet


Definition at line 43 of file CustomUppercaseCollation.php.

Referenced by __construct().

◆ $firstLetters

array CustomUppercaseCollation::$firstLetters

Definition at line 49 of file CustomUppercaseCollation.php.

◆ $puaSubset


Definition at line 46 of file CustomUppercaseCollation.php.

The documentation for this class was generated from the following file: