gender.h 3.3 KB

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