ICU 76.1  76.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 
23 U_NAMESPACE_BEGIN
24 
44 public:
51  public:
60  this->grammaticalCase = grammaticalCase;
61  return *this;
62  }
63 
72  this->nounClass = nounClass;
73  return *this;
74  }
75 
84  this->pluralCategory = pluralCategory;
85  return *this;
86  }
87 
96  this->capitalization = capitalization;
97  return *this;
98  }
99 
108  this->nameStyle = nameStyle;
109  return *this;
110  }
111 
120  this->displayLength = displayLength;
121  return *this;
122  }
123 
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__
UDisplayOptionsGrammaticalCase getGrammaticalCase() const
Gets the grammatical case.
Builder & setCapitalization(UDisplayOptionsCapitalization capitalization)
Sets the capitalization.
C API: API for accessing ICU version numbers.
UDisplayOptionsPluralCategory getPluralCategory() const
Gets the plural category.
UDisplayOptionsNounClass getNounClass() const
Gets the noun class.
DisplayOptions build()
Builds the display options.
Builder & setNounClass(UDisplayOptionsNounClass nounClass)
Sets the noun class.
UDisplayOptionsSubstituteHandling
Represents all the substitute handling.
UDisplayOptionsSubstituteHandling getSubstituteHandling() const
Gets the substitute handling.
UDisplayOptionsNameStyle getNameStyle() const
Gets the dialect handling.
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside...
Definition: utypes.h:316
Responsible for building DisplayOptions.
Represents all the display options that are supported by CLDR such as grammatical case...
C API: Display options (enum types, values, helper functions)
Builder & setDisplayLength(UDisplayOptionsDisplayLength displayLength)
Sets the display length.
UDisplayOptionsGrammaticalCase
Represents all the grammatical cases that are supported by CLDR.
Builder & setPluralCategory(UDisplayOptionsPluralCategory pluralCategory)
Sets the plural category.
Builder & setNameStyle(UDisplayOptionsNameStyle nameStyle)
Sets the dialect handling.
Builder & setSubstituteHandling(UDisplayOptionsSubstituteHandling substituteHandling)
Sets the substitute handling.
UDisplayOptionsPluralCategory
Standard CLDR plural form/category constants.
Builder & setGrammaticalCase(UDisplayOptionsGrammaticalCase grammaticalCase)
Sets the grammatical case.
UDisplayOptionsCapitalization getCapitalization() const
Gets the capitalization.
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.
UDisplayOptionsDisplayLength getDisplayLength() const
Gets the display length.
UDisplayOptionsNameStyle
Represents all the dialect handlings.
UDisplayOptionsCapitalization
Represents all the capitalization options.