ICU 77.1  77.1
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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();
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__
Responsible for building DisplayOptions.
Builder & setNounClass(UDisplayOptionsNounClass nounClass)
Sets the noun class.
Builder & setPluralCategory(UDisplayOptionsPluralCategory pluralCategory)
Sets the plural category.
Builder & setDisplayLength(UDisplayOptionsDisplayLength displayLength)
Sets the display length.
Builder & setCapitalization(UDisplayOptionsCapitalization capitalization)
Sets the capitalization.
Builder & setNameStyle(UDisplayOptionsNameStyle nameStyle)
Sets the dialect handling.
DisplayOptions build()
Builds the display options.
Builder & setSubstituteHandling(UDisplayOptionsSubstituteHandling substituteHandling)
Sets the substitute handling.
Builder & setGrammaticalCase(UDisplayOptionsGrammaticalCase grammaticalCase)
Sets the grammatical case.
Represents all the display options that are supported by CLDR such as grammatical case,...
DisplayOptions & operator=(DisplayOptions &&other) noexcept=default
Moves 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.
DisplayOptions & operator=(const DisplayOptions &other)=default
Copies the DisplayOptions.
UDisplayOptionsPluralCategory getPluralCategory() const
Gets the plural category.
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:316
C API: API for accessing ICU version numbers.