summaryrefslogtreecommitdiff
path: root/Build/source/libs/icu/icu-4.4/i18n/unicode/locdspnm.h
blob: 12c4e4603a2c276e554283c0bf546ff29d8653d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
/*
******************************************************************************
* Copyright (C) 2010, International Business Machines Corporation and        *
* others. All Rights Reserved.                                               *
******************************************************************************
*/

#ifndef LOCDSPNM_H
#define LOCDSPNM_H

#include "unicode/utypes.h"

/**
 * \file
 * \brief C++ API: Provides display names of Locale and its components.
 */

#if !UCONFIG_NO_FORMATTING

#include "unicode/locid.h"
#include "unicode/uscript.h"
#include "unicode/uldnames.h"

U_NAMESPACE_BEGIN

/**
 * Returns display names of Locales and components of Locales. For
 * more information on language, script, region, variant, key, and
 * values, see Locale.
 * @draft ICU 4.4
 */
class U_I18N_API LocaleDisplayNames : public UObject {
public:
    /**
     * Destructor.
     * @draft ICU 4.4
     */
    virtual ~LocaleDisplayNames();

    /**
     * Convenience overload of
     * {@link #createInstance(const Locale& locale, UDialectHandling dialectHandling)}
     * that specifies STANDARD dialect handling.
     * @param locale the display locale
     * @return a LocaleDisplayNames instance
     * @draft ICU 4.4
     */
    static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale);

    /**
     * Returns an instance of LocaleDisplayNames that returns names
     * formatted for the provided locale, using the provided
     * dialectHandling.
     *
     * @param locale the display locale
     * @param dialectHandling how to select names for locales
     * @return a LocaleDisplayNames instance
     * @draft ICU 4.4
     */
    static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale,
							UDialectHandling dialectHandling);

    // getters for state
    /**
     * Returns the locale used to determine the display names. This is
     * not necessarily the same locale passed to {@link #getInstance}.
     * @return the display locale
     * @draft ICU 4.4
     */
    virtual const Locale& getLocale() const = 0;

    /**
     * Returns the dialect handling used in the display names.
     * @return the dialect handling enum
     * @draft ICU 4.4
     */
    virtual UDialectHandling getDialectHandling() const = 0;

    // names for entire locales
    /**
     * Returns the display name of the provided locale.
     * @param locale the locale whose display name to return
     * @param result receives the locale's display name
     * @return the display name of the provided locale
     * @draft ICU 4.4
     */
    virtual UnicodeString& localeDisplayName(const Locale& locale,
					     UnicodeString& result) const = 0;

    /**
     * Returns the display name of the provided locale id.
     * @param localeId the id of the locale whose display name to return
     * @param result receives the locale's display name
     * @return the display name of the provided locale
     * @draft ICU 4.4
     */
    virtual UnicodeString& localeDisplayName(const char* localeId,
					     UnicodeString& result) const = 0;

    // names for components of a locale id
    /**
     * Returns the display name of the provided language code.
     * @param lang the language code
     * @param result receives the language code's display name
     * @return the display name of the provided language code
     * @draft ICU 4.4
     */
    virtual UnicodeString& languageDisplayName(const char* lang,
					       UnicodeString& result) const = 0;

    /**
     * Returns the display name of the provided script code.
     * @param script the script code
     * @param result receives the script code's display name
     * @return the display name of the provided script code
     * @draft ICU 4.4
     */
    virtual UnicodeString& scriptDisplayName(const char* script,
					     UnicodeString& result) const = 0;

    /**
     * Returns the display name of the provided script code.
     * @param scriptCode the script code number
     * @param result receives the script code's display name
     * @return the display name of the provided script code
     * @draft ICU 4.4
     */
    virtual UnicodeString& scriptDisplayName(UScriptCode scriptCode,
					     UnicodeString& result) const = 0;

    /**
     * Returns the display name of the provided region code.
     * @param region the region code
     * @param result receives the region code's display name
     * @return the display name of the provided region code
     * @draft ICU 4.4
     */
    virtual UnicodeString& regionDisplayName(const char* region,
					     UnicodeString& result) const = 0;

    /**
     * Returns the display name of the provided variant.
     * @param variant the variant string
     * @param result receives the variant's display name
     * @return the display name of the provided variant
     * @draft ICU 4.4
     */
    virtual UnicodeString& variantDisplayName(const char* variant,
					      UnicodeString& result) const = 0;

    /**
     * Returns the display name of the provided locale key.
     * @param key the locale key name
     * @param result receives the locale key's display name
     * @return the display name of the provided locale key
     * @draft ICU 4.4
     */
    virtual UnicodeString& keyDisplayName(const char* key,
					  UnicodeString& result) const = 0;

    /**
     * Returns the display name of the provided value (used with the provided key).
     * @param key the locale key name
     * @param value the locale key's value
     * @param result receives the value's display name
     * @return the display name of the provided value
     * @draft ICU 4.4
     */
    virtual UnicodeString& keyValueDisplayName(const char* key, const char* value,
					       UnicodeString& result) const = 0;

    /**
     * ICU "poor man's RTTI", returns a UClassID for this class.
     * @returns a UClassID for this class.
     * @internal ICU 4.4  // TODO @draft ICU 4.6
     */
    static UClassID U_EXPORT2 getStaticClassID();
};

inline LocaleDisplayNames::~LocaleDisplayNames() {
}

inline LocaleDisplayNames* LocaleDisplayNames::createInstance(const Locale& locale) {
  return LocaleDisplayNames::createInstance(locale, ULDN_STANDARD_NAMES);
}

U_NAMESPACE_END

#endif

#endif