ICU 72.1 72.1

displayoptions.h
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
13 #include "unicode/udisplayoptions.h"
14 #include "unicode/uversion.h"
15
16 U_NAMESPACE_BEGIN
17
18 #ifndef U_HIDE_DRAFT_API
19
38 class U_I18N_API DisplayOptions {
39 public:
45 class U_I18N_API Builder {
46 public:
54 Builder &setGrammaticalCase(UDisplayOptionsGrammaticalCase grammaticalCase) {
55 this->grammaticalCase = grammaticalCase;
56 return *this;
57 }
58
66 Builder &setNounClass(UDisplayOptionsNounClass nounClass) {
67 this->nounClass = nounClass;
68 return *this;
69 }
70
78 Builder &setPluralCategory(UDisplayOptionsPluralCategory pluralCategory) {
79 this->pluralCategory = pluralCategory;
80 return *this;
81 }
82
90 Builder &setCapitalization(UDisplayOptionsCapitalization capitalization) {
91 this->capitalization = capitalization;
92 return *this;
93 }
94
102 Builder &setNameStyle(UDisplayOptionsNameStyle nameStyle) {
103 this->nameStyle = nameStyle;
104 return *this;
105 }
106
114 Builder &setDisplayLength(UDisplayOptionsDisplayLength displayLength) {
115 this->displayLength = displayLength;
116 return *this;
117 }
118
126 Builder &setSubstituteHandling(UDisplayOptionsSubstituteHandling substituteHandling) {
127 this->substituteHandling = substituteHandling;
128 return *this;
129 }
130
137 DisplayOptions build() { return DisplayOptions(*this); }
138
139 private:
140 friend DisplayOptions;
141
142 Builder();
143 Builder(const DisplayOptions &displayOptions);
144
145 UDisplayOptionsGrammaticalCase grammaticalCase;
146 UDisplayOptionsNounClass nounClass;
147 UDisplayOptionsPluralCategory pluralCategory;
148 UDisplayOptionsCapitalization capitalization;
149 UDisplayOptionsNameStyle nameStyle;
150 UDisplayOptionsDisplayLength displayLength;
151 UDisplayOptionsSubstituteHandling substituteHandling;
152 };
153
160 static Builder builder();
167 Builder copyToBuilder() const;
174 UDisplayOptionsGrammaticalCase getGrammaticalCase() const { return grammaticalCase; }
175
182 UDisplayOptionsNounClass getNounClass() const { return nounClass; }
183
190 UDisplayOptionsPluralCategory getPluralCategory() const { return pluralCategory; }
191
198 UDisplayOptionsCapitalization getCapitalization() const { return capitalization; }
199
206 UDisplayOptionsNameStyle getNameStyle() const { return nameStyle; }
207
214 UDisplayOptionsDisplayLength getDisplayLength() const { return displayLength; }
215
222 UDisplayOptionsSubstituteHandling getSubstituteHandling() const { return substituteHandling; }
223
230 DisplayOptions &operator=(const DisplayOptions &other) = default;
231
238 DisplayOptions &operator=(DisplayOptions &&other) noexcept = default;
239
246 DisplayOptions(const DisplayOptions &other) = default;
247
248 private:
249 DisplayOptions(const Builder &builder);
250 UDisplayOptionsGrammaticalCase grammaticalCase;
251 UDisplayOptionsNounClass nounClass;
252 UDisplayOptionsPluralCategory pluralCategory;
253 UDisplayOptionsCapitalization capitalization;
254 UDisplayOptionsNameStyle nameStyle;
255 UDisplayOptionsDisplayLength displayLength;
256 UDisplayOptionsSubstituteHandling substituteHandling;
257 };
258
259 #endif // U_HIDE_DRAFT_API
260
261 U_NAMESPACE_END
262
263 #endif /* #if !UCONFIG_NO_FORMATTING */
264
265 #endif /* U_SHOW_CPLUSPLUS_API */
266
267 #endif // __DISPLAYOPTIONS_H__
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.