ICU 4.8.1.1
4.8.1.1
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
common
unicode
locid.h
Go to the documentation of this file.
1
/*
2
******************************************************************************
3
*
4
* Copyright (C) 1996-2011, International Business Machines
5
* Corporation and others. All Rights Reserved.
6
*
7
******************************************************************************
8
*
9
* File locid.h
10
*
11
* Created by: Helena Shih
12
*
13
* Modification History:
14
*
15
* Date Name Description
16
* 02/11/97 aliu Changed gLocPath to fgLocPath and added methods to
17
* get and set it.
18
* 04/02/97 aliu Made operator!= inline; fixed return value of getName().
19
* 04/15/97 aliu Cleanup for AIX/Win32.
20
* 04/24/97 aliu Numerous changes per code review.
21
* 08/18/98 stephen Added tokenizeString(),changed getDisplayName()
22
* 09/08/98 stephen Moved definition of kEmptyString for Mac Port
23
* 11/09/99 weiv Added const char * getName() const;
24
* 04/12/00 srl removing unicodestring api's and cached hash code
25
* 08/10/01 grhoten Change the static Locales to accessor functions
26
******************************************************************************
27
*/
28
29
#ifndef LOCID_H
30
#define LOCID_H
31
32
#include "
unicode/utypes.h
"
33
#include "
unicode/uobject.h
"
34
#include "
unicode/unistr.h
"
35
#include "
unicode/putil.h
"
36
#include "
unicode/uloc.h
"
37
#include "
unicode/strenum.h
"
38
180
U_NAMESPACE_BEGIN
181
class
U_COMMON_API
Locale
:
public
UObject
{
182
public
:
184
static
const
Locale
&
U_EXPORT2
getRoot(
void
);
186
static
const
Locale
&
U_EXPORT2
getEnglish(
void
);
188
static
const
Locale
&
U_EXPORT2
getFrench(
void
);
190
static
const
Locale
&
U_EXPORT2
getGerman(
void
);
192
static
const
Locale
&
U_EXPORT2
getItalian(
void
);
194
static
const
Locale
&
U_EXPORT2
getJapanese(
void
);
196
static
const
Locale
&
U_EXPORT2
getKorean(
void
);
198
static
const
Locale
&
U_EXPORT2
getChinese(
void
);
200
static
const
Locale
&
U_EXPORT2
getSimplifiedChinese(
void
);
202
static
const
Locale
&
U_EXPORT2
getTraditionalChinese(
void
);
203
205
static
const
Locale
&
U_EXPORT2
getFrance(
void
);
207
static
const
Locale
&
U_EXPORT2
getGermany(
void
);
209
static
const
Locale
&
U_EXPORT2
getItaly(
void
);
211
static
const
Locale
&
U_EXPORT2
getJapan(
void
);
213
static
const
Locale
&
U_EXPORT2
getKorea(
void
);
215
static
const
Locale
&
U_EXPORT2
getChina(
void
);
217
static
const
Locale
&
U_EXPORT2
getPRC(
void
);
219
static
const
Locale
&
U_EXPORT2
getTaiwan(
void
);
221
static
const
Locale
&
U_EXPORT2
getUK(
void
);
223
static
const
Locale
&
U_EXPORT2
getUS(
void
);
225
static
const
Locale
&
U_EXPORT2
getCanada(
void
);
227
static
const
Locale
&
U_EXPORT2
getCanadaFrench(
void
);
228
229
237
Locale
();
238
263
Locale
(
const
char
* language,
264
const
char
* country = 0,
265
const
char
* variant = 0,
266
const
char
* keywordsAndValues = 0);
267
274
Locale
(
const
Locale
& other);
275
276
281
virtual
~
Locale
() ;
282
290
Locale
& operator=(
const
Locale
& other);
291
299
UBool
operator==
(
const
Locale
& other)
const
;
300
309
UBool
operator!=
(
const
Locale
& other)
const
;
310
322
Locale
*clone()
const
;
323
339
static
const
Locale
&
U_EXPORT2
getDefault(
void
);
340
353
static
void
U_EXPORT2
setDefault(
const
Locale
& newLocale,
354
UErrorCode
& success);
355
365
static
Locale
U_EXPORT2
createFromName(
const
char
*name);
366
375
static
Locale
U_EXPORT2
createCanonical(
const
char
* name);
376
382
inline
const
char
* getLanguage( )
const
;
383
391
inline
const
char
* getScript( )
const
;
392
398
inline
const
char
* getCountry( )
const
;
399
405
inline
const
char
* getVariant( )
const
;
406
415
inline
const
char
* getName()
const
;
416
424
const
char
* getBaseName()
const
;
425
426
435
StringEnumeration
* createKeywords(
UErrorCode
&status)
const
;
436
448
int32_t getKeywordValue(
const
char
* keywordName,
char
*buffer, int32_t bufferCapacity,
UErrorCode
&status)
const
;
449
461
void
setKeywordValue(
const
char
* keywordName,
const
char
* keywordValue,
UErrorCode
&status);
462
469
const
char
* getISO3Language()
const
;
470
476
const
char
* getISO3Country()
const
;
477
485
uint32_t getLCID(
void
)
const
;
486
496
UnicodeString
& getDisplayLanguage(
UnicodeString
& dispLang)
const
;
497
511
UnicodeString
& getDisplayLanguage(
const
Locale
& displayLocale,
512
UnicodeString
& dispLang)
const
;
513
523
UnicodeString
& getDisplayScript(
UnicodeString
& dispScript)
const
;
524
539
UnicodeString
& getDisplayScript(
const
Locale
& displayLocale,
540
UnicodeString
& dispScript)
const
;
541
551
UnicodeString
& getDisplayCountry(
UnicodeString
& dispCountry)
const
;
552
567
UnicodeString
& getDisplayCountry(
const
Locale
& displayLocale,
568
UnicodeString
& dispCountry)
const
;
569
577
UnicodeString
& getDisplayVariant(
UnicodeString
& dispVar)
const
;
578
587
UnicodeString
& getDisplayVariant(
const
Locale
& displayLocale,
588
UnicodeString
& dispVar)
const
;
589
601
UnicodeString
& getDisplayName(
UnicodeString
& name)
const
;
602
615
UnicodeString
& getDisplayName(
const
Locale
& displayLocale,
616
UnicodeString
& name)
const
;
617
622
int32_t hashCode(
void
)
const
;
623
632
void
setToBogus();
633
639
UBool
isBogus(
void
)
const
;
640
649
static
const
Locale
*
U_EXPORT2
getAvailableLocales(int32_t& count);
650
659
static
const
char
*
const
*
U_EXPORT2
getISOCountries();
660
669
static
const
char
*
const
*
U_EXPORT2
getISOLanguages();
670
676
static
UClassID
U_EXPORT2
getStaticClassID();
677
683
virtual
UClassID
getDynamicClassID
()
const
;
684
685
protected
:
/* only protected for testing purposes. DO NOT USE. */
690
void
setFromPOSIXID(
const
char
*posixID);
691
692
private
:
700
Locale
& init(
const
char
* cLocaleID,
UBool
canonicalize);
701
702
/*
703
* Internal constructor to allow construction of a locale object with
704
* NO side effects. (Default constructor tries to get
705
* the default locale.)
706
*/
707
enum
ELocaleType {
708
eBOGUS
709
};
710
Locale
(ELocaleType);
711
715
static
Locale
*getLocaleCache(
void
);
716
717
char
language[
ULOC_LANG_CAPACITY
];
718
char
script[
ULOC_SCRIPT_CAPACITY
];
719
char
country[
ULOC_COUNTRY_CAPACITY
];
720
int32_t variantBegin;
721
char
* fullName;
722
char
fullNameBuffer[
ULOC_FULLNAME_CAPACITY
];
723
// name without keywords
724
char
* baseName;
725
char
baseNameBuffer[
ULOC_FULLNAME_CAPACITY
];
726
727
UBool
fIsBogus;
728
729
static
const
Locale
&getLocale(
int
locid);
730
735
friend
Locale
*locale_set_default_internal(
const
char
*,
UErrorCode
& status);
736
};
737
738
inline
UBool
739
Locale::operator!=
(
const
Locale
& other)
const
740
{
741
return
!
operator==
(other);
742
}
743
744
inline
const
char
*
745
Locale::getCountry
()
const
746
{
747
return
country;
748
}
749
750
inline
const
char
*
751
Locale::getLanguage
()
const
752
{
753
return
language;
754
}
755
756
inline
const
char
*
757
Locale::getScript
()
const
758
{
759
return
script;
760
}
761
762
inline
const
char
*
763
Locale::getVariant
()
const
764
{
765
getBaseName
();
// lazy init
766
return
&baseName[variantBegin];
767
}
768
769
inline
const
char
*
770
Locale::getName
()
const
771
{
772
return
fullName;
773
}
774
775
inline
UBool
776
Locale::isBogus
(
void
)
const
{
777
return
fIsBogus;
778
}
779
780
U_NAMESPACE_END
781
782
#endif
Generated on Wed Nov 27 2019 19:32:13 for ICU 4.8.1.1 by
1.8.1.2