gender.h 3.2 KB

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