ICU 74.1 74.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
43 class U_I18N_API DisplayOptions {
44 public:
50 class U_I18N_API Builder {
51 public:
59 Builder &setGrammaticalCase(UDisplayOptionsGrammaticalCase grammaticalCase) {
60 this->grammaticalCase = grammaticalCase;
61 return *this;
62 }
63
71 Builder &setNounClass(UDisplayOptionsNounClass nounClass) {
72 this->nounClass = nounClass;
73 return *this;
74 }
75
83 Builder &setPluralCategory(UDisplayOptionsPluralCategory pluralCategory) {
84 this->pluralCategory = pluralCategory;
85 return *this;
86 }
87
95 Builder &setCapitalization(UDisplayOptionsCapitalization capitalization) {
96 this->capitalization = capitalization;
97 return *this;
98 }
99
107 Builder &setNameStyle(UDisplayOptionsNameStyle nameStyle) {
108 this->nameStyle = nameStyle;
109 return *this;
110 }
111
119 Builder &setDisplayLength(UDisplayOptionsDisplayLength displayLength) {
120 this->displayLength = displayLength;
121 return *this;
122 }
123
131 Builder &setSubstituteHandling(UDisplayOptionsSubstituteHandling substituteHandling) {
132 this->substituteHandling = substituteHandling;
133 return *this;
134 }
135
142 DisplayOptions build() { return DisplayOptions(*this); }
143
144 private:
145 friend DisplayOptions;
146
147 Builder();
148 Builder(const DisplayOptions &displayOptions);
149
150 UDisplayOptionsGrammaticalCase grammaticalCase;
151 UDisplayOptionsNounClass nounClass;
152 UDisplayOptionsPluralCategory pluralCategory;
153 UDisplayOptionsCapitalization capitalization;
154 UDisplayOptionsNameStyle nameStyle;
155 UDisplayOptionsDisplayLength displayLength;
156 UDisplayOptionsSubstituteHandling substituteHandling;
157 };
158
165 static Builder builder();
172 Builder copyToBuilder() const;
179 UDisplayOptionsGrammaticalCase getGrammaticalCase() const { return grammaticalCase; }
180
187 UDisplayOptionsNounClass getNounClass() const { return nounClass; }
188
195 UDisplayOptionsPluralCategory getPluralCategory() const { return pluralCategory; }
196
203 UDisplayOptionsCapitalization getCapitalization() const { return capitalization; }
204
211 UDisplayOptionsNameStyle getNameStyle() const { return nameStyle; }
212
219 UDisplayOptionsDisplayLength getDisplayLength() const { return displayLength; }
220
227 UDisplayOptionsSubstituteHandling getSubstituteHandling() const { return substituteHandling; }
228
235 DisplayOptions &operator=(const DisplayOptions &other) = default;
236
243 DisplayOptions &operator=(DisplayOptions &&other) noexcept = default;
244
251 DisplayOptions(const DisplayOptions &other) = default;
252
253 private:
254 DisplayOptions(const Builder &builder);
255 UDisplayOptionsGrammaticalCase grammaticalCase;
256 UDisplayOptionsNounClass nounClass;
257 UDisplayOptionsPluralCategory pluralCategory;
258 UDisplayOptionsCapitalization capitalization;
259 UDisplayOptionsNameStyle nameStyle;
260 UDisplayOptionsDisplayLength displayLength;
261 UDisplayOptionsSubstituteHandling substituteHandling;
262 };
263
264 U_NAMESPACE_END
265
266 #endif /* #if !UCONFIG_NO_FORMATTING */
267
268 #endif /* U_SHOW_CPLUSPLUS_API */
269
270 #endif // __DISPLAYOPTIONS_H__
icu::DisplayOptions::Builder
Responsible for building DisplayOptions.
Definition: displayoptions.h:50
icu::DisplayOptions::Builder::setNounClass
Builder & setNounClass(UDisplayOptionsNounClass nounClass)
Sets the noun class.
Definition: displayoptions.h:71
icu::DisplayOptions::Builder::setPluralCategory
Builder & setPluralCategory(UDisplayOptionsPluralCategory pluralCategory)
Sets the plural category.
Definition: displayoptions.h:83
icu::DisplayOptions::Builder::setDisplayLength
Builder & setDisplayLength(UDisplayOptionsDisplayLength displayLength)
Sets the display length.
Definition: displayoptions.h:119
icu::DisplayOptions::Builder::setCapitalization
Builder & setCapitalization(UDisplayOptionsCapitalization capitalization)
Sets the capitalization.
Definition: displayoptions.h:95
icu::DisplayOptions::Builder::setNameStyle
Builder & setNameStyle(UDisplayOptionsNameStyle nameStyle)
Sets the dialect handling.
Definition: displayoptions.h:107
icu::DisplayOptions::Builder::build
DisplayOptions build()
Builds the display options.
Definition: displayoptions.h:142
icu::DisplayOptions::Builder::setSubstituteHandling
Builder & setSubstituteHandling(UDisplayOptionsSubstituteHandling substituteHandling)
Sets the substitute handling.
Definition: displayoptions.h:131
icu::DisplayOptions::Builder::setGrammaticalCase
Builder & setGrammaticalCase(UDisplayOptionsGrammaticalCase grammaticalCase)
Sets the grammatical case.
Definition: displayoptions.h:59
icu::DisplayOptions
Represents all the display options that are supported by CLDR such as grammatical case,...
Definition: displayoptions.h:43
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:227
icu::DisplayOptions::getNameStyle
UDisplayOptionsNameStyle getNameStyle() const
Gets the dialect handling.
Definition: displayoptions.h:211
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:203
icu::DisplayOptions::getGrammaticalCase
UDisplayOptionsGrammaticalCase getGrammaticalCase() const
Gets the grammatical case.
Definition: displayoptions.h:179
icu::DisplayOptions::getNounClass
UDisplayOptionsNounClass getNounClass() const
Gets the noun class.
Definition: displayoptions.h:187
icu::DisplayOptions::getDisplayLength
UDisplayOptionsDisplayLength getDisplayLength() const
Gets the display length.
Definition: displayoptions.h:219
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:195
udisplayoptions.h
C API: Display options (enum types, values, helper functions)
UDisplayOptionsCapitalization
UDisplayOptionsCapitalization
Represents all the capitalization options.
Definition: udisplayoptions.h:183
UDisplayOptionsSubstituteHandling
UDisplayOptionsSubstituteHandling
Represents all the substitute handling.
Definition: udisplayoptions.h:293
UDisplayOptionsPluralCategory
UDisplayOptionsPluralCategory
Standard CLDR plural form/category constants.
Definition: udisplayoptions.h:87
UDisplayOptionsGrammaticalCase
UDisplayOptionsGrammaticalCase
Represents all the grammatical cases that are supported by CLDR.
Definition: udisplayoptions.h:26
UDisplayOptionsNameStyle
UDisplayOptionsNameStyle
Represents all the dialect handlings.
Definition: udisplayoptions.h:231
UDisplayOptionsNounClass
UDisplayOptionsNounClass
Represents all the grammatical noun classes that are supported by CLDR.
Definition: udisplayoptions.h:134
UDisplayOptionsDisplayLength
UDisplayOptionsDisplayLength
Represents all the display lengths.
Definition: udisplayoptions.h:262
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.