Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

UCollator Class Reference

Inheritance diagram for UCollator:

ICU List of all members.

Public Types

typedef void * UParseError
typedef AttributeValue Strength
enum  Attribute {
  FrenchCollation, AlternateHandling, CaseFirst, CaseLevel,
  NormalizationMode, DecompositionMode = NormalizationMode, strength, HiraganaQuaternaryMode,
  NumericCollation, AttributeCount
}
enum  AttributeValue {
  Default = -1, Primary = 0, Secondary = 1, Tertiary = 2,
  DefaultStrength = Tertiary, CeStrengthLimit, Quaternary = 3, Identical = 15,
  strengthLimit, Off = 16, On = 17, Shifted = 20,
  NonIgnorable = 21, LowerFirst = 24, UpperFirst = 25, AttributeValueCount
}
enum  RuleOption { TailoringOnly, FullRules }
enum  BoundMode { BoundLower = 0, BoundUpper = 1, BoundUpperLong = 2, BoundValueCount }

Public Member Functions

 this (ULocale locale)
 this (UText rules, AttributeValue mode, Strength strength)
 this (char[] shortName, bool forceDefaults)
package this (Handle handle)
 ~this ()
void getContractions (USet set)
int strcoll (UText source, UText target)
bool greater (UText source, UText target)
bool greaterOrEqual (UText source, UText target)
bool equal (UText source, UText target)
Strength getStrength ()
void setStrength (Strength s)
void getDisplayName (ULocale obj, ULocale display, UString dst)
void getRules (UString dst, RuleOption o=RuleOption.FullRules)
char[] getShortDefinitionString (ULocale locale=ULocale.Default)
char[] normalizeShortDefinitionString (char[] source)
ubyte[] getSortKey (UText t, ubyte[] result)
ubyte[] mergeSortkeys (ubyte[] left, ubyte[] right, ubyte[] result)
ubyte[] getBound (BoundMode mode, ubyte[] source, ubyte[] result, uint levels=1)
void getVersion (inout Version v)
void getUCAVersion (inout Version v)
void setAttribute (Attribute attr, AttributeValue value)
AttributeValue getAttribute (Attribute attr)
void setVariableTop (UText t)
void setVariableTop (uint x)
uint getVariableTop ()
void getLocale (ULocale locale, ULocale.Type type)
USet getTailoredSet ()

Static Public Member Functions

static this ()
static ~this ()

Public Attributes

package Handle handle

Static Public Attributes

static FunctionLoader Bind[] targets

Private Types

typedef void * Handle
enum  Error { OK, BufferOverflow = 15 }

Static Private Member Functions

static bool isError (Error e)
static void testError (Error e, char[] msg)
static char * toString (char[] string)
static wchar * toString (wchar[] string)
static uint length (char *s)
static uint length (wchar *s)
static char[] toArray (char *s)
static wchar[] toArray (wchar *s)

Static Private Attributes

static void * library

Detailed Description

The API for Collator performs locale-sensitive string comparison. You use this service to build searching and sorting routines for natural language text. Important: The ICU collation service has been reimplemented in order to achieve better performance and UCA compliance. For details, see the collation design document.

For more information about the collation service see the users guide.

Collation service provides correct sorting orders for most locales supported in ICU. If specific data for a locale is not available, the orders eventually falls back to the UCA sort order.

Sort ordering may be customized by providing your own set of rules. For more on this subject see the Collation customization section of the users guide.

See this page for full details.

Definition at line 115 of file UCollator.d.


Member Typedef Documentation

typedef void* UParseError
 

Definition at line 119 of file UCollator.d.

typedef AttributeValue Strength
 

Definition at line 169 of file UCollator.d.

typedef void* Handle [protected, inherited]
 

Use this for the primary argument-type to most ICU functions

Definition at line 112 of file ICU.d.


Member Enumeration Documentation

enum Attribute
 

Enumeration values:
FrenchCollation 
AlternateHandling 
CaseFirst 
CaseLevel 
NormalizationMode 
DecompositionMode 
strength 
HiraganaQuaternaryMode 
NumericCollation 
AttributeCount 

Definition at line 121 of file UCollator.d.

enum AttributeValue
 

Enumeration values:
Default 
Primary 
Secondary 
Tertiary 
DefaultStrength 
CeStrengthLimit 
Quaternary 
Identical 
strengthLimit 
Off 
On 
Shifted 
NonIgnorable 
LowerFirst 
UpperFirst 
AttributeValueCount 

Definition at line 135 of file UCollator.d.

enum RuleOption
 

Enumeration values:
TailoringOnly 
FullRules 

Definition at line 155 of file UCollator.d.

enum BoundMode
 

Enumeration values:
BoundLower 
BoundUpper 
BoundUpperLong 
BoundValueCount 

Definition at line 161 of file UCollator.d.

enum Error [protected, inherited]
 

ICU error codes (the ones which are referenced)

Enumeration values:
OK 
BufferOverflow 

Definition at line 146 of file ICU.d.


Constructor & Destructor Documentation

~this  )  [inline]
 

Close a UCollator

Definition at line 248 of file UCollator.d.

static ~this  )  [inline, static]
 

Definition at line 729 of file UCollator.d.


Member Function Documentation

this ULocale  locale  )  [inline]
 

Open a UCollator for comparing strings. The locale specified determines the required collation rules. Special values for locales can be passed in - if ULocale.Default is passed for the locale, the default locale collation rules will be used. If ULocale.Root is passed, UCA rules will be used

Definition at line 181 of file UCollator.d.

References ICU::testError(), and ICU::toString().

this UText  rules,
AttributeValue  mode,
Strength  strength
[inline]
 

Produce a UCollator instance according to the rules supplied.

The rules are used to change the default ordering, defined in the UCA in a process called tailoring. For the syntax of the rules please see users guide

Definition at line 199 of file UCollator.d.

References ICU::testError().

this char[]  shortName,
bool  forceDefaults
[inline]
 

Open a collator defined by a short form string. The structure and the syntax of the string is defined in the "Naming collators" section of the users guide: http://oss.software.ibm.com/icu/userguide/Collate_Concepts.html#Naming_Collators Attributes are overriden by the subsequent attributes. So, for "S2_S3", final strength will be 3. 3066bis locale overrides individual locale parts.

The call to this constructor is equivalent to a plain constructor, followed by a series of calls to setAttribute and setVariableTop

Definition at line 223 of file UCollator.d.

References ICU::testError(), and ICU::toString().

package this Handle  handle  )  [inline]
 

Internal constructor invoked via USearch

Definition at line 237 of file UCollator.d.

void getContractions USet  set  )  [inline]
 

Get a set containing the contractions defined by the collator.

The set includes both the UCA contractions and the contractions defined by the collator. This set will contain only strings. If a tailoring explicitly suppresses contractions from the UCA (like Russian), removed contractions will not be in the resulting set.

Definition at line 266 of file UCollator.d.

References USet::handle, and ICU::testError().

int strcoll UText  source,
UText  target
[inline]
 

Compare two strings. Return value is -, 0, +

Definition at line 280 of file UCollator.d.

References UText::get(), and UText::len.

bool greater UText  source,
UText  target
[inline]
 

Determine if one string is greater than another. This function is equivalent to strcoll() > 1

Definition at line 292 of file UCollator.d.

References UText::get(), and UText::len.

bool greaterOrEqual UText  source,
UText  target
[inline]
 

Determine if one string is greater than or equal to another. This function is equivalent to strcoll() >= 0

Definition at line 304 of file UCollator.d.

References UText::get(), and UText::len.

bool equal UText  source,
UText  target
[inline]
 

This function is equivalent to strcoll() == 0

Definition at line 315 of file UCollator.d.

References UText::get(), and UText::len.

Strength getStrength  )  [inline]
 

Get the collation strength used in a UCollator. The strength influences how strings are compared.

Definition at line 327 of file UCollator.d.

void setStrength Strength  s  )  [inline]
 

Set the collation strength used in this UCollator. The strength influences how strings are compared. one of Primary, Secondary, Tertiary, Quaternary, Dentical, or Default

Definition at line 341 of file UCollator.d.

void getDisplayName ULocale  obj,
ULocale  display,
UString  dst
[inline]
 

Get the display name for a UCollator. The display name is suitable for presentation to a user

Definition at line 353 of file UCollator.d.

References UString::format(), UText::get(), UText::len, ULocale::name, and ICU::toString().

void getRules UString  dst,
RuleOption  o = RuleOption.FullRules
[inline]
 

Returns current rules. Options define whether full rules are returned or just the tailoring.

Definition at line 370 of file UCollator.d.

References UString::format(), UText::get(), and UText::len.

char [] getShortDefinitionString ULocale  locale = ULocale.Default  )  [inline]
 

Get the short definition string for a collator.

This API harvests the collator's locale and the attribute set and produces a string that can be used for opening a collator with the same properties using the char[] style constructor. This string will be normalized.

The structure and the syntax of the string is defined in the "Naming collators" section of the users guide: http://oss.software.ibm.com/icu/userguide/Collate_Concepts.html#Naming_Collators

Definition at line 398 of file UCollator.d.

References ICU::testError(), and ICU::toString().

char [] normalizeShortDefinitionString char[]  source  )  [inline]
 

Verifies and normalizes short definition string. Normalized short definition string has all the option sorted by the argument name, so that equivalent definition strings are the same

Definition at line 417 of file UCollator.d.

References ICU::testError(), and ICU::toString().

ubyte [] getSortKey UText  t,
ubyte[]  result
[inline]
 

Get a sort key for a string from a UCollator. Sort keys may be compared using strcmp.

Definition at line 434 of file UCollator.d.

References UText::get(), UText::len, and UText::length().

ubyte [] mergeSortkeys ubyte[]  left,
ubyte[]  right,
ubyte[]  result
[inline]
 

Merge two sort keys. The levels are merged with their corresponding counterparts (primaries with primaries, secondaries with secondaries etc.). Between the values from the same level a separator is inserted. example (uncompressed): 191B1D 01 050505 01 910505 00 and 1F2123 01 050505 01 910505 00 will be merged as 191B1D 02 1F212301 050505 02 050505 01 910505 02 910505 00 This allows for concatenating of first and last names for sorting, among other things. If the destination buffer is not big enough, the results are undefined. If any of source lengths are zero or any of source pointers are null/undefined, result is of size zero.

Definition at line 459 of file UCollator.d.

ubyte [] getBound BoundMode  mode,
ubyte[]  source,
ubyte[]  result,
uint  levels = 1
[inline]
 

Produce a bound for a given sortkey and a number of levels.

Return value is always the number of bytes needed, regardless of whether the result buffer was big enough or even valid.

Resulting bounds can be used to produce a range of strings that are between upper and lower bounds. For example, if bounds are produced for a sortkey of string "smith", strings between upper and lower bounds with one level would include "Smith", "SMITH", "sMiTh".

There are two upper bounds that can be produced. If BoundUpper is produced, strings matched would be as above. However, if bound produced using BoundUpperLong is used, the above example will also match "Smithsonian" and similar.

Definition at line 487 of file UCollator.d.

References ICU::testError().

void getVersion inout Version  v  )  [inline]
 

Gets the version information for a Collator.

Version is currently an opaque 32-bit number which depends, among other things, on major versions of the collator tailoring and UCA

Definition at line 508 of file UCollator.d.

void getUCAVersion inout Version  v  )  [inline]
 

Gets the UCA version information for this Collator

Definition at line 519 of file UCollator.d.

void setAttribute Attribute  attr,
AttributeValue  value
[inline]
 

Universal attribute setter

Definition at line 530 of file UCollator.d.

References ICU::testError().

AttributeValue getAttribute Attribute  attr  )  [inline]
 

Universal attribute getter

Definition at line 544 of file UCollator.d.

References ICU::testError().

void setVariableTop UText  t  )  [inline]
 

Variable top is a two byte primary value which causes all the codepoints with primary values that are less or equal than the variable top to be shifted when alternate handling is set to Shifted.

Definition at line 562 of file UCollator.d.

References UText::get(), UText::len, and ICU::testError().

void setVariableTop uint  x  )  [inline]
 

Sets the variable top to a collation element value supplied.Variable top is set to the upper 16 bits. Lower 16 bits are ignored.

Definition at line 578 of file UCollator.d.

References ICU::testError(), and x.

uint getVariableTop  )  [inline]
 

Gets the variable top value of this Collator. Lower 16 bits are undefined and should be ignored.

Definition at line 593 of file UCollator.d.

References ICU::testError(), and x.

void getLocale ULocale  locale,
ULocale.Type  type
[inline]
 

Gets the locale name of the collator. If the collator is instantiated from the rules, then this function will throw an exception

Definition at line 610 of file UCollator.d.

References ICU::isError(), ULocale::name, and ICU::toArray().

USet getTailoredSet  )  [inline]
 

Get the Unicode set that contains all the characters and sequences tailored in this collator.

Definition at line 626 of file UCollator.d.

References ICU::testError(), and USet.

static this  )  [inline, static]
 

Definition at line 720 of file UCollator.d.

static bool isError Error  e  )  [inline, static, protected, inherited]
 

Definition at line 156 of file ICU.d.

Referenced by getLocale().

static void testError Error  e,
char[]  msg
[inline, static, protected, inherited]
 

Definition at line 174 of file ICU.d.

Referenced by UCalendar::add(), USet::applyPattern(), UChar::charFromName(), UNormalize::check(), URegex::clone(), UNormalize::compare(), UDomainName::compare(), UText::compareFolded(), UConverter::UTranscoder::convert(), UEnumeration::count(), UConverter::decode(), UConverter::encode(), URegex::end(), UTransform::execute(), USearch::first(), UResourceBundle::get(), UCalendar::get(), getAttribute(), UResourceBundle::getBinary(), getBound(), UChar::getCharName(), UChar::getComment(), getContractions(), URegex::getFlags(), UResourceBundle::getInt(), UResourceBundle::getIntVector(), UCalendar::getLimit(), UResourceBundle::getLocale(), UCalendar::getMillis(), UConverter::getName(), UResourceBundle::getNextString(), URegex::getPattern(), getShortDefinitionString(), UResourceBundle::getString(), getTailoredSet(), UDateFormat::getTwoDigitYearStart(), getVariableTop(), URegex::groupCount(), UCalendar::inDaylightTime(), UNormalize::isNormalized(), USearch::last(), URegex::match(), USearch::next(), URegex::next(), UEnumeration::next(), normalizeShortDefinitionString(), UDateFormat::parse(), USearch::previous(), URegex::probe(), URegex::replaceAll(), URegex::replaceFirst(), URegex::reset(), UEnumeration::reset(), UCalendar::roll(), setAttribute(), USearch::setCollator(), UCalendar::setDate(), UCalendar::setDateTime(), UTransform::setFilter(), USearch::setIterator(), UCalendar::setMillis(), USearch::setOffset(), USearch::setPattern(), UDecimalFormat::setPattern(), UMessageFormat::setPattern(), USearch::setText(), URegex::setText(), UBreakIterator::setText(), UCalendar::setTimeZone(), UDateFormat::setTwoDigitYearStart(), setVariableTop(), URegex::split(), URegex::start(), UTransform::this(), UStringPrep::this(), USet::this(), USearch::this(), UResourceBundle::this(), URegex::this(), UNumberFormat::this(), UMessageFormat::this(), UDateFormat::this(), this(), UCalendar::this(), UBreakIterator::this(), URuleIterator::this(), and UText::toUtf8().

static char* toString char[]  string  )  [inline, static, protected, inherited]
 

Definition at line 184 of file ICU.d.

Referenced by UChar::charFromName(), UConverter::compareNames(), getDisplayName(), UResourceBundle::getResource(), getShortDefinitionString(), UResourceBundle::getString(), UCalendar::getTimeZoneName(), normalizeShortDefinitionString(), UMessageFormat::setLocale(), UStringPrep::this(), UResourceBundle::this(), UDateFormat::this(), this(), UBreakIterator::this(), UText::toLower(), and UText::toUpper().

static wchar* toString wchar[]  string  )  [inline, static, protected, inherited]
 

Definition at line 206 of file ICU.d.

static uint length char *  s  )  [inline, static, protected, inherited]
 

Definition at line 228 of file ICU.d.

References strlen().

Referenced by UConverter::UTranscoder::convert().

static uint length wchar *  s  )  [inline, static, protected, inherited]
 

Definition at line 237 of file ICU.d.

References wcslen().

static char [] toArray char *  s  )  [inline, static, protected, inherited]
 

Definition at line 246 of file ICU.d.

References strlen().

Referenced by UConverter::detectSignature(), UResourceBundle::getKey(), UResourceBundle::getLocale(), UMessageFormat::getLocale(), getLocale(), UConverter::getName(), UChar::getPropertyName(), UChar::getPropertyValueName(), and UConverter::opApply().

static wchar [] toArray wchar *  s  )  [inline, static, protected, inherited]
 

Definition at line 257 of file ICU.d.

References wcslen().


Member Data Documentation

package Handle handle
 

Definition at line 117 of file UCollator.d.

Referenced by USearch::setCollator().

void* library [static, private]
 

Bind the ICU functions from a shared library. This is complicated by the issues regarding D and DLLs on the Windows platform

Definition at line 644 of file UCollator.d.

FunctionLoader Bind [] targets [static]
 

Initial value:

 
                [
                {cast(void**) &ucol_open,                               "ucol_open"}

Definition at line 685 of file UCollator.d.


The documentation for this class was generated from the following file:
Generated on Fri Nov 11 18:44:45 2005 for Mango by  doxygen 1.4.0