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