• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 *******************************************************************************
5 * Copyright (C) 2008-2013, International Business Machines Corporation and
6 * others. All Rights Reserved.
7 *******************************************************************************
8 *
9 *
10 * File GENDER.H
11 *
12 * Modification History:*
13 *   Date        Name        Description
14 *
15 ********************************************************************************
16 */
17 
18 #ifndef _GENDER
19 #define _GENDER
20 
21 /**
22  * \file
23  * \brief C++ API: GenderInfo computes the gender of a list.
24  */
25 
26 #include "unicode/utypes.h"
27 
28 #if !UCONFIG_NO_FORMATTING
29 
30 #include "unicode/locid.h"
31 #include "unicode/ugender.h"
32 #include "unicode/uobject.h"
33 
34 class GenderInfoTest;
35 
36 U_NAMESPACE_BEGIN
37 
38 /** \internal Forward Declaration  */
39 void U_CALLCONV GenderInfo_initCache(UErrorCode &status);
40 
41 /**
42  * GenderInfo computes the gender of a list as a whole given the gender of
43  * each element.
44  * @stable ICU 50
45  */
46 class U_I18N_API GenderInfo : public UObject {
47 public:
48 
49     /**
50      * Provides access to the predefined GenderInfo object for a given
51      * locale.
52      *
53      * @param locale  The locale for which a <code>GenderInfo</code> object is
54      *                returned.
55      * @param status  Output param set to success/failure code on exit, which
56      *                must not indicate a failure before the function call.
57      * @return        The predefined <code>GenderInfo</code> object pointer for
58      *                this locale. The returned object is immutable, so it is
59      *                declared as const. Caller does not own the returned
60      *                pointer, so it must not attempt to free it.
61      * @stable ICU 50
62      */
63     static const GenderInfo* U_EXPORT2 getInstance(const Locale& locale, UErrorCode& status);
64 
65     /**
66      * Determines the gender of a list as a whole given the gender of each
67      * of the elements.
68      *
69      * @param genders the gender of each element in the list.
70      * @param length the length of gender array.
71      * @param status  Output param set to success/failure code on exit, which
72      *                must not indicate a failure before the function call.
73      * @return        the gender of the whole list.
74      * @stable ICU 50
75      */
76     UGender getListGender(const UGender* genders, int32_t length, UErrorCode& status) const;
77 
78     /**
79      * Destructor.
80      *
81      * @stable ICU 50
82      */
83     virtual ~GenderInfo();
84 
85 private:
86     int32_t _style;
87 
88     /**
89      * Copy constructor. One object per locale invariant. Clients
90      * must never copy GenderInfo objects.
91      */
92     GenderInfo(const GenderInfo& other);
93 
94     /**
95       * Assignment operator. Not applicable to immutable objects.
96       */
97     GenderInfo& operator=(const GenderInfo&);
98 
99     GenderInfo();
100 
101     static const GenderInfo* getNeutralInstance();
102 
103     static const GenderInfo* getMixedNeutralInstance();
104 
105     static const GenderInfo* getMaleTaintsInstance();
106 
107     static const GenderInfo* loadInstance(const Locale& locale, UErrorCode& status);
108 
109     friend class ::GenderInfoTest;
110     friend void U_CALLCONV GenderInfo_initCache(UErrorCode &status);
111 };
112 
113 U_NAMESPACE_END
114 
115 #endif /* #if !UCONFIG_NO_FORMATTING */
116 
117 #endif // _GENDER
118 //eof
119