]>
git.saurik.com Git - apple/icu.git/blob - icuSources/common/locbased.cpp
2 **********************************************************************
3 * Copyright (c) 2004-2014, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
7 * Created: January 16 2004
9 **********************************************************************
16 Locale
LocaleBased::getLocale(ULocDataLocaleType type
, UErrorCode
& status
) const {
17 const char* id
= getLocaleID(type
, status
);
18 return Locale((id
!= 0) ? id
: "");
21 const char* LocaleBased::getLocaleID(ULocDataLocaleType type
, UErrorCode
& status
) const {
22 if (U_FAILURE(status
)) {
27 case ULOC_VALID_LOCALE
:
29 case ULOC_ACTUAL_LOCALE
:
32 status
= U_ILLEGAL_ARGUMENT_ERROR
;
37 void LocaleBased::setLocaleIDs(const char* validID
, const char* actualID
) {
39 uprv_strncpy(valid
, validID
, ULOC_FULLNAME_CAPACITY
);
40 valid
[ULOC_FULLNAME_CAPACITY
-1] = 0; // always terminate
43 uprv_strncpy(actual
, actualID
, ULOC_FULLNAME_CAPACITY
);
44 actual
[ULOC_FULLNAME_CAPACITY
-1] = 0; // always terminate
48 void LocaleBased::setLocaleIDs(const Locale
& validID
, const Locale
& actualID
) {
49 uprv_strcpy(valid
, validID
.getName());
50 uprv_strcpy(actual
, actualID
.getName());