OLD | NEW |
1 /* | 1 /* |
2 ********************************************************************** | 2 ********************************************************************** |
3 * Copyright (c) 2004, International Business Machines | 3 * Copyright (c) 2004-2014, International Business Machines |
4 * Corporation and others. All Rights Reserved. | 4 * Corporation and others. All Rights Reserved. |
5 ********************************************************************** | 5 ********************************************************************** |
6 * Author: Alan Liu | 6 * Author: Alan Liu |
7 * Created: January 16 2004 | 7 * Created: January 16 2004 |
8 * Since: ICU 2.8 | 8 * Since: ICU 2.8 |
9 ********************************************************************** | 9 ********************************************************************** |
10 */ | 10 */ |
11 #ifndef LOCBASED_H | 11 #ifndef LOCBASED_H |
12 #define LOCBASED_H | 12 #define LOCBASED_H |
13 | 13 |
14 #include "unicode/locid.h" | 14 #include "unicode/locid.h" |
15 #include "unicode/uobject.h" | 15 #include "unicode/uobject.h" |
16 | 16 |
17 /** | 17 /** |
18 * Macro to declare a locale LocaleBased wrapper object for the given | 18 * Macro to declare a locale LocaleBased wrapper object for the given |
19 * object, which must have two members named `validLocale' and | 19 * object, which must have two members named `validLocale' and |
20 * `actualLocale'. | 20 * `actualLocale' of size ULOC_FULLNAME_CAPACITY |
21 */ | 21 */ |
22 #define U_LOCALE_BASED(varname, objname) \ | 22 #define U_LOCALE_BASED(varname, objname) \ |
23 LocaleBased varname((objname).validLocale, (objname).actualLocale); | 23 LocaleBased varname((objname).validLocale, (objname).actualLocale); |
24 | 24 |
25 U_NAMESPACE_BEGIN | 25 U_NAMESPACE_BEGIN |
26 | 26 |
27 /** | 27 /** |
28 * A utility class that unifies the implementation of getLocale() by | 28 * A utility class that unifies the implementation of getLocale() by |
29 * various ICU services. This class is likely to be removed in the | 29 * various ICU services. This class is likely to be removed in the |
30 * ICU 3.0 time frame in favor of an integrated approach with the | 30 * ICU 3.0 time frame in favor of an integrated approach with the |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 const char* getLocaleID(ULocDataLocaleType type, UErrorCode& status) const; | 68 const char* getLocaleID(ULocDataLocaleType type, UErrorCode& status) const; |
69 | 69 |
70 /** | 70 /** |
71 * Set the locale meta-data for the service object wrapped by this | 71 * Set the locale meta-data for the service object wrapped by this |
72 * object. If either parameter is zero, it is ignored. | 72 * object. If either parameter is zero, it is ignored. |
73 * @param valid the ID of the valid locale | 73 * @param valid the ID of the valid locale |
74 * @param actual the ID of the actual locale | 74 * @param actual the ID of the actual locale |
75 */ | 75 */ |
76 void setLocaleIDs(const char* valid, const char* actual); | 76 void setLocaleIDs(const char* valid, const char* actual); |
77 | 77 |
| 78 /** |
| 79 * Set the locale meta-data for the service object wrapped by this |
| 80 * object. |
| 81 * @param valid the ID of the valid locale |
| 82 * @param actual the ID of the actual locale |
| 83 */ |
| 84 void setLocaleIDs(const Locale& valid, const Locale& actual); |
| 85 |
78 private: | 86 private: |
79 | 87 |
80 char* valid; | 88 char* valid; |
81 | 89 |
82 char* actual; | 90 char* actual; |
83 }; | 91 }; |
84 | 92 |
85 inline LocaleBased::LocaleBased(char* validAlias, char* actualAlias) : | 93 inline LocaleBased::LocaleBased(char* validAlias, char* actualAlias) : |
86 valid(validAlias), actual(actualAlias) { | 94 valid(validAlias), actual(actualAlias) { |
87 } | 95 } |
88 | 96 |
89 inline LocaleBased::LocaleBased(const char* validAlias, | 97 inline LocaleBased::LocaleBased(const char* validAlias, |
90 const char* actualAlias) : | 98 const char* actualAlias) : |
91 // ugh: cast away const | 99 // ugh: cast away const |
92 valid((char*)validAlias), actual((char*)actualAlias) { | 100 valid((char*)validAlias), actual((char*)actualAlias) { |
93 } | 101 } |
94 | 102 |
95 U_NAMESPACE_END | 103 U_NAMESPACE_END |
96 | 104 |
97 #endif | 105 #endif |
OLD | NEW |