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