gender.h 3.1 KB

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