intl/icu/source/common/locbased.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /*
     2 **********************************************************************
     3 * Copyright (c) 2004, International Business Machines
     4 * Corporation and others.  All Rights Reserved.
     5 **********************************************************************
     6 * Author: Alan Liu
     7 * Created: January 16 2004
     8 * Since: ICU 2.8
     9 **********************************************************************
    10 */
    11 #include "locbased.h"
    12 #include "cstring.h"
    14 U_NAMESPACE_BEGIN
    16 Locale LocaleBased::getLocale(ULocDataLocaleType type, UErrorCode& status) const {
    17     const char* id = getLocaleID(type, status);
    18     return Locale((id != 0) ? id : "");
    19 }
    21 const char* LocaleBased::getLocaleID(ULocDataLocaleType type, UErrorCode& status) const {
    22     if (U_FAILURE(status)) {
    23         return NULL;
    24     }
    26     switch(type) {
    27     case ULOC_VALID_LOCALE:
    28         return valid;
    29     case ULOC_ACTUAL_LOCALE:
    30         return actual;
    31     default:
    32         status = U_ILLEGAL_ARGUMENT_ERROR;
    33         return NULL;
    34     }
    35 }
    37 void LocaleBased::setLocaleIDs(const char* validID, const char* actualID) {
    38     if (validID != 0) {
    39         uprv_strcpy(valid, validID);
    40     }
    41     if (actualID != 0) {
    42         uprv_strcpy(actual, actualID);
    43     }
    44 }
    46 U_NAMESPACE_END

mercurial