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 U_SHOW_CPLUSPLUS_API
29
30#if !UCONFIG_NO_FORMATTING
31
32#include "unicode/locid.h"
33#include "unicode/ugender.h"
34#include "unicode/uobject.h"
35
36class GenderInfoTest;
37
38U_NAMESPACE_BEGIN
39
40/** \internal Forward Declaration */
41void U_CALLCONV GenderInfo_initCache(UErrorCode &status);
42
43/**
44 * GenderInfo computes the gender of a list as a whole given the gender of
45 * each element.
46 * @stable ICU 50
47 */
48class U_I18N_API GenderInfo : public UObject {
49public:
50
51 /**
52 * Provides access to the predefined GenderInfo object for a given
53 * locale.
54 *
55 * @param locale The locale for which a <code>GenderInfo</code> object is
56 * returned.
57 * @param status Output param set to success/failure code on exit, which
58 * must not indicate a failure before the function call.
59 * @return The predefined <code>GenderInfo</code> object pointer for
60 * this locale. The returned object is immutable, so it is
61 * declared as const. Caller does not own the returned
62 * pointer, so it must not attempt to free it.
63 * @stable ICU 50
64 */
65 static const GenderInfo* U_EXPORT2 getInstance(const Locale& locale, UErrorCode& status);
66
67 /**
68 * Determines the gender of a list as a whole given the gender of each
69 * of the elements.
70 *
71 * @param genders the gender of each element in the list.
72 * @param length the length of gender array.
73 * @param status Output param set to success/failure code on exit, which
74 * must not indicate a failure before the function call.
75 * @return the gender of the whole list.
76 * @stable ICU 50
77 */
78 UGender getListGender(const UGender* genders, int32_t length, UErrorCode& status) const;
79
80 /**
81 * Destructor.
82 *
83 * @stable ICU 50
84 */
85 virtual ~GenderInfo();
86
87private:
88 int32_t _style;
89
90 /**
91 * Copy constructor. One object per locale invariant. Clients
92 * must never copy GenderInfo objects.
93 */
94 GenderInfo(const GenderInfo& other);
95
96 /**
97 * Assignment operator. Not applicable to immutable objects.
98 */
99 GenderInfo& operator=(const GenderInfo&);
100
101 GenderInfo();
102
103 static const GenderInfo* getNeutralInstance();
104
105 static const GenderInfo* getMixedNeutralInstance();
106
107 static const GenderInfo* getMaleTaintsInstance();
108
109 static const GenderInfo* loadInstance(const Locale& locale, UErrorCode& status);
110
111 friend class ::GenderInfoTest;
112 friend void U_CALLCONV GenderInfo_initCache(UErrorCode &status);
113};
114
115U_NAMESPACE_END
116
117#endif /* #if !UCONFIG_NO_FORMATTING */
118
119#endif /* U_SHOW_CPLUSPLUS_API */
120
121#endif // _GENDER
122//eof
123