ICU 73.1 73.1

displayoptions.h
Go to the documentation of this file.
1 // © 2022 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3
4 #ifndef __DISPLAYOPTIONS_H__
5 #define __DISPLAYOPTIONS_H__
6
7 #include "unicode/utypes.h"
8
9 #if U_SHOW_CPLUSPLUS_API
10
11 #if !UCONFIG_NO_FORMATTING
12
20 #include "unicode/udisplayoptions.h"
21 #include "unicode/uversion.h"
22
23 U_NAMESPACE_BEGIN
24
25 #ifndef U_HIDE_DRAFT_API
26
45 class U_I18N_API DisplayOptions {
46 public:
52 class U_I18N_API Builder {
53 public:
61 Builder &setGrammaticalCase(UDisplayOptionsGrammaticalCase grammaticalCase) {
62 this->grammaticalCase = grammaticalCase;
63 return *this;
64 }
65
73 Builder &setNounClass(UDisplayOptionsNounClass nounClass) {
74 this->nounClass = nounClass;
75 return *this;
76 }
77
85 Builder &setPluralCategory(UDisplayOptionsPluralCategory pluralCategory) {
86 this->pluralCategory = pluralCategory;
87 return *this;
88 }
89
97 Builder &setCapitalization(UDisplayOptionsCapitalization capitalization) {
98 this->capitalization = capitalization;
99 return *this;
100 }
101
109 Builder &setNameStyle(UDisplayOptionsNameStyle nameStyle) {
110 this->nameStyle = nameStyle;
111 return *this;
112 }
113
121 Builder &setDisplayLength(UDisplayOptionsDisplayLength displayLength) {
122 this->displayLength = displayLength;
123 return *this;
124 }
125
133 Builder &setSubstituteHandling(UDisplayOptionsSubstituteHandling substituteHandling) {
134 this->substituteHandling = substituteHandling;
135 return *this;
136 }
137
144 DisplayOptions build() { return DisplayOptions(*this); }
145
146 private:
147 friend DisplayOptions;
148
149 Builder();
150 Builder(const DisplayOptions &displayOptions);
151
152 UDisplayOptionsGrammaticalCase grammaticalCase;
153 UDisplayOptionsNounClass nounClass;
154 UDisplayOptionsPluralCategory pluralCategory;
155 UDisplayOptionsCapitalization capitalization;
156 UDisplayOptionsNameStyle nameStyle;
157 UDisplayOptionsDisplayLength displayLength;
158 UDisplayOptionsSubstituteHandling substituteHandling;
159 };
160
167 static Builder builder();
174 Builder copyToBuilder() const;
181 UDisplayOptionsGrammaticalCase getGrammaticalCase() const { return grammaticalCase; }
182
189 UDisplayOptionsNounClass getNounClass() const { return nounClass; }
190
197 UDisplayOptionsPluralCategory getPluralCategory() const { return pluralCategory; }
198
205 UDisplayOptionsCapitalization getCapitalization() const { return capitalization; }
206
213 UDisplayOptionsNameStyle getNameStyle() const { return nameStyle; }
214
221 UDisplayOptionsDisplayLength getDisplayLength() const { return displayLength; }
222
229 UDisplayOptionsSubstituteHandling getSubstituteHandling() const { return substituteHandling; }
230
237 DisplayOptions &operator=(const DisplayOptions &other) = default;
238
245 DisplayOptions &operator=(DisplayOptions &&other) noexcept = default;
246
253 DisplayOptions(const DisplayOptions &other) = default;
254
255 private:
256 DisplayOptions(const Builder &builder);
257 UDisplayOptionsGrammaticalCase grammaticalCase;
258 UDisplayOptionsNounClass nounClass;
259 UDisplayOptionsPluralCategory pluralCategory;
260 UDisplayOptionsCapitalization capitalization;
261 UDisplayOptionsNameStyle nameStyle;
262 UDisplayOptionsDisplayLength displayLength;
263 UDisplayOptionsSubstituteHandling substituteHandling;
264 };
265
266 #endif // U_HIDE_DRAFT_API
267
268 U_NAMESPACE_END
269
270 #endif /* #if !UCONFIG_NO_FORMATTING */
271
272 #endif /* U_SHOW_CPLUSPLUS_API */
273
274 #endif // __DISPLAYOPTIONS_H__
icu::DisplayOptions::Builder
Responsible for building DisplayOptions.
Definition: displayoptions.h:52
icu::DisplayOptions::Builder::setNounClass
Builder & setNounClass(UDisplayOptionsNounClass nounClass)
Sets the noun class.
Definition: displayoptions.h:73
icu::DisplayOptions::Builder::setPluralCategory
Builder & setPluralCategory(UDisplayOptionsPluralCategory pluralCategory)
Sets the plural category.
Definition: displayoptions.h:85
icu::DisplayOptions::Builder::setDisplayLength
Builder & setDisplayLength(UDisplayOptionsDisplayLength displayLength)
Sets the display length.
Definition: displayoptions.h:121
icu::DisplayOptions::Builder::setCapitalization
Builder & setCapitalization(UDisplayOptionsCapitalization capitalization)
Sets the capitalization.
Definition: displayoptions.h:97
icu::DisplayOptions::Builder::setNameStyle
Builder & setNameStyle(UDisplayOptionsNameStyle nameStyle)
Sets the dialect handling.
Definition: displayoptions.h:109
icu::DisplayOptions::Builder::build
DisplayOptions build()
Builds the display options.
Definition: displayoptions.h:144
icu::DisplayOptions::Builder::setSubstituteHandling
Builder & setSubstituteHandling(UDisplayOptionsSubstituteHandling substituteHandling)
Sets the substitute handling.
Definition: displayoptions.h:133
icu::DisplayOptions::Builder::setGrammaticalCase
Builder & setGrammaticalCase(UDisplayOptionsGrammaticalCase grammaticalCase)
Sets the grammatical case.
Definition: displayoptions.h:61
icu::DisplayOptions
Represents all the display options that are supported by CLDR such as grammatical case,...
Definition: displayoptions.h:45
icu::DisplayOptions::operator=
DisplayOptions & operator=(DisplayOptions &&other) noexcept=default
Moves the DisplayOptions.
icu::DisplayOptions::DisplayOptions
DisplayOptions(const DisplayOptions &other)=default
Copies the DisplayOptions.
icu::DisplayOptions::getSubstituteHandling
UDisplayOptionsSubstituteHandling getSubstituteHandling() const
Gets the substitute handling.
Definition: displayoptions.h:229
icu::DisplayOptions::getNameStyle
UDisplayOptionsNameStyle getNameStyle() const
Gets the dialect handling.
Definition: displayoptions.h:213
icu::DisplayOptions::builder
static Builder builder()
Creates a builder with the UNDEFINED values for all the parameters.
icu::DisplayOptions::getCapitalization
UDisplayOptionsCapitalization getCapitalization() const
Gets the capitalization.
Definition: displayoptions.h:205
icu::DisplayOptions::getGrammaticalCase
UDisplayOptionsGrammaticalCase getGrammaticalCase() const
Gets the grammatical case.
Definition: displayoptions.h:181
icu::DisplayOptions::getNounClass
UDisplayOptionsNounClass getNounClass() const
Gets the noun class.
Definition: displayoptions.h:189
icu::DisplayOptions::getDisplayLength
UDisplayOptionsDisplayLength getDisplayLength() const
Gets the display length.
Definition: displayoptions.h:221
icu::DisplayOptions::copyToBuilder
Builder copyToBuilder() const
Creates a builder with the same parameters from this object.
icu::DisplayOptions::operator=
DisplayOptions & operator=(const DisplayOptions &other)=default
Copies the DisplayOptions.
icu::DisplayOptions::getPluralCategory
UDisplayOptionsPluralCategory getPluralCategory() const
Gets the plural category.
Definition: displayoptions.h:197
udisplayoptions.h
C API: Display options (enum types, values, helper functions)
UDisplayOptionsCapitalization
UDisplayOptionsCapitalization
Represents all the capitalization options.
Definition: udisplayoptions.h:185
UDisplayOptionsSubstituteHandling
UDisplayOptionsSubstituteHandling
Represents all the substitute handling.
Definition: udisplayoptions.h:295
UDisplayOptionsPluralCategory
UDisplayOptionsPluralCategory
Standard CLDR plural form/category constants.
Definition: udisplayoptions.h:89
UDisplayOptionsGrammaticalCase
UDisplayOptionsGrammaticalCase
Represents all the grammatical cases that are supported by CLDR.
Definition: udisplayoptions.h:28
UDisplayOptionsNameStyle
UDisplayOptionsNameStyle
Represents all the dialect handlings.
Definition: udisplayoptions.h:233
UDisplayOptionsNounClass
UDisplayOptionsNounClass
Represents all the grammatical noun classes that are supported by CLDR.
Definition: udisplayoptions.h:136
UDisplayOptionsDisplayLength
UDisplayOptionsDisplayLength
Represents all the display lengths.
Definition: udisplayoptions.h:264
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
U_I18N_API
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
Definition: utypes.h:301
uversion.h
C API: API for accessing ICU version numbers.