ICU 72.1 72.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
21#include "unicode/uversion.h"
22
23U_NAMESPACE_BEGIN
24
25#ifndef U_HIDE_DRAFT_API
26
46public:
53 public:
62 this->grammaticalCase = grammaticalCase;
63 return *this;
64 }
65
74 this->nounClass = nounClass;
75 return *this;
76 }
77
86 this->pluralCategory = pluralCategory;
87 return *this;
88 }
89
98 this->capitalization = capitalization;
99 return *this;
100 }
101
110 this->nameStyle = nameStyle;
111 return *this;
112 }
113
122 this->displayLength = displayLength;
123 return *this;
124 }
125
134 this->substituteHandling = substituteHandling;
135 return *this;
136 }
137
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();
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
255private:
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
268U_NAMESPACE_END
269
270#endif /* #if !UCONFIG_NO_FORMATTING */
271
272#endif /* U_SHOW_CPLUSPLUS_API */
273
274#endif // __DISPLAYOPTIONS_H__
Responsible for building DisplayOptions.
Builder & setNameStyle(UDisplayOptionsNameStyle nameStyle)
Sets the dialect handling.
Builder & setSubstituteHandling(UDisplayOptionsSubstituteHandling substituteHandling)
Sets the substitute handling.
Builder & setCapitalization(UDisplayOptionsCapitalization capitalization)
Sets the capitalization.
Builder & setNounClass(UDisplayOptionsNounClass nounClass)
Sets the noun class.
Builder & setGrammaticalCase(UDisplayOptionsGrammaticalCase grammaticalCase)
Sets the grammatical case.
DisplayOptions build()
Builds the display options.
Builder & setPluralCategory(UDisplayOptionsPluralCategory pluralCategory)
Sets the plural category.
Builder & setDisplayLength(UDisplayOptionsDisplayLength displayLength)
Sets the display length.
Represents all the display options that are supported by CLDR such as grammatical case,...
DisplayOptions & operator=(const DisplayOptions &other)=default
Copies the DisplayOptions.
DisplayOptions(const DisplayOptions &other)=default
Copies the DisplayOptions.
UDisplayOptionsSubstituteHandling getSubstituteHandling() const
Gets the substitute handling.
UDisplayOptionsNameStyle getNameStyle() const
Gets the dialect handling.
static Builder builder()
Creates a builder with the UNDEFINED values for all the parameters.
UDisplayOptionsCapitalization getCapitalization() const
Gets the capitalization.
UDisplayOptionsGrammaticalCase getGrammaticalCase() const
Gets the grammatical case.
UDisplayOptionsNounClass getNounClass() const
Gets the noun class.
UDisplayOptionsDisplayLength getDisplayLength() const
Gets the display length.
Builder copyToBuilder() const
Creates a builder with the same parameters from this object.
UDisplayOptionsPluralCategory getPluralCategory() const
Gets the plural category.
DisplayOptions & operator=(DisplayOptions &&other) noexcept=default
Moves the DisplayOptions.
C API: Display options (enum types, values, helper functions)
UDisplayOptionsCapitalization
Represents all the capitalization options.
UDisplayOptionsSubstituteHandling
Represents all the substitute handling.
UDisplayOptionsPluralCategory
Standard CLDR plural form/category constants.
UDisplayOptionsGrammaticalCase
Represents all the grammatical cases that are supported by CLDR.
UDisplayOptionsNameStyle
Represents all the dialect handlings.
UDisplayOptionsNounClass
Represents all the grammatical noun classes that are supported by CLDR.
UDisplayOptionsDisplayLength
Represents all the display lengths.
Basic definitions for ICU, for both C and C++ APIs.
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
Definition: utypes.h:301
C API: API for accessing ICU version numbers.