Logo Search packages:      
Sourcecode: icu version File versions

RuleBasedCollator::RuleBasedCollator ( const Locale desiredLocale,
UErrorCode status 
) [private]

RuleBasedCollator constructor. This constructor takes a locale. The only caller of this class should be Collator::createInstance(). If createInstance() happens to know that the requested locale's collation is implemented as a RuleBasedCollator, it can then call this constructor. OTHERWISE IT SHOULDN'T, since this constructor ALWAYS RETURNS A VALID COLLATION TABLE. It does this by falling back to defaults.

Parameters:
desiredLocalelocale used
statuserror code status

Definition at line 689 of file tblcoll.cpp.

References setUCollator(), U_FAILURE, U_SUCCESS, U_USING_DEFAULT_WARNING, and U_ZERO_ERROR.

 : dataIsOwned(FALSE), isWriteThroughAlias(FALSE), ucollator(NULL)
{
    if (U_FAILURE(status))
        return;

    /*
    Try to load, in order:
     1. The desired locale's collation.
     2. A fallback of the desired locale.
     3. The default locale's collation.
     4. A fallback of the default locale.
     5. The default collation rules, which contains en_US collation rules.

     To reiterate, we try:
     Specific:
      language+country+variant
      language+country
      language
     Default:
      language+country+variant
      language+country
      language
     Root: (aka DEFAULTRULES)
     steps 1-5 are handled by resource bundle fallback mechanism.
     however, in a very unprobable situation that no resource bundle
     data exists, step 5 is repeated with hardcoded default rules.
    */

    setUCollator(desiredLocale, status);

    if (U_FAILURE(status))
    {
        status = U_ZERO_ERROR;

        setUCollator(kRootLocaleName, status);
        if (status == U_ZERO_ERROR) {
            status = U_USING_DEFAULT_WARNING;
        }
    }

    if (U_SUCCESS(status))
    {
        setRuleStringFromCollator();
    }
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index