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