]>
git.saurik.com Git - apple/icu.git/blob - icuSources/common/locbased.cpp
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 **********************************************************************
5 * Copyright (c) 2004-2014, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 **********************************************************************
9 * Created: January 16 2004
11 **********************************************************************
18 Locale
LocaleBased::getLocale(ULocDataLocaleType type
, UErrorCode
& status
) const {
19 const char* id
= getLocaleID(type
, status
);
20 return Locale((id
!= 0) ? id
: "");
23 const char* LocaleBased::getLocaleID(ULocDataLocaleType type
, UErrorCode
& status
) const {
24 if (U_FAILURE(status
)) {
29 case ULOC_VALID_LOCALE
:
31 case ULOC_ACTUAL_LOCALE
:
34 status
= U_ILLEGAL_ARGUMENT_ERROR
;
39 void LocaleBased::setLocaleIDs(const char* validID
, const char* actualID
) {
41 uprv_strncpy(valid
, validID
, ULOC_FULLNAME_CAPACITY
);
42 valid
[ULOC_FULLNAME_CAPACITY
-1] = 0; // always terminate
45 uprv_strncpy(actual
, actualID
, ULOC_FULLNAME_CAPACITY
);
46 actual
[ULOC_FULLNAME_CAPACITY
-1] = 0; // always terminate
50 void LocaleBased::setLocaleIDs(const Locale
& validID
, const Locale
& actualID
) {
51 uprv_strcpy(valid
, validID
.getName());
52 uprv_strcpy(actual
, actualID
.getName());