cecal.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. // © 2016 and later: Unicode, Inc. and others.
  2. // License & terms of use: http://www.unicode.org/copyright.html
  3. /*
  4. *******************************************************************************
  5. * Copyright (C) 2003 - 2008, International Business Machines Corporation and *
  6. * others. All Rights Reserved. *
  7. *******************************************************************************
  8. */
  9. #ifndef CECAL_H
  10. #define CECAL_H
  11. #include "unicode/utypes.h"
  12. #if !UCONFIG_NO_FORMATTING
  13. #include "unicode/calendar.h"
  14. U_NAMESPACE_BEGIN
  15. /**
  16. * Base class for EthiopicCalendar and CopticCalendar.
  17. * @internal
  18. */
  19. class U_I18N_API CECalendar : public Calendar {
  20. protected:
  21. //-------------------------------------------------------------------------
  22. // Constructors...
  23. //-------------------------------------------------------------------------
  24. /**
  25. * Constructs a CECalendar based on the current time in the default time zone
  26. * with the given locale with the Julian epoch offiset
  27. *
  28. * @param aLocale The given locale.
  29. * @param success Indicates the status of CECalendar object construction.
  30. * Returns U_ZERO_ERROR if constructed successfully.
  31. * @internal
  32. */
  33. CECalendar(const Locale& aLocale, UErrorCode& success);
  34. /**
  35. * Copy Constructor
  36. * @internal
  37. */
  38. CECalendar (const CECalendar& other);
  39. /**
  40. * Destructor.
  41. * @internal
  42. */
  43. virtual ~CECalendar();
  44. /**
  45. * Default assignment operator
  46. * @param right Calendar object to be copied
  47. * @internal
  48. */
  49. CECalendar& operator=(const CECalendar& right);
  50. protected:
  51. //-------------------------------------------------------------------------
  52. // Calendar framework
  53. //-------------------------------------------------------------------------
  54. /**
  55. * Return JD of start of given month/extended year
  56. * @internal
  57. */
  58. virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month, UBool useMonth) const;
  59. /**
  60. * Calculate the limit for a specified type of limit and field
  61. * @internal
  62. */
  63. virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const;
  64. /**
  65. * (Overrides Calendar) Return true if the current date for this Calendar is in
  66. * Daylight Savings Time. Recognizes DST_OFFSET, if it is set.
  67. *
  68. * @param status Fill-in parameter which receives the status of this operation.
  69. * @return True if the current date for this Calendar is in Daylight Savings Time,
  70. * false, otherwise.
  71. * @internal
  72. */
  73. virtual UBool inDaylightTime(UErrorCode&) const;
  74. /**
  75. * Returns TRUE because Coptic/Ethiopic Calendar does have a default century
  76. * @internal
  77. */
  78. virtual UBool haveDefaultCentury() const;
  79. protected:
  80. /**
  81. * The Coptic and Ethiopic calendars differ only in their epochs.
  82. * This method must be implemented by CECalendar subclasses to
  83. * return the date offset from Julian
  84. * @internal
  85. */
  86. virtual int32_t getJDEpochOffset() const = 0;
  87. /**
  88. * Convert an Coptic/Ethiopic year, month, and day to a Julian day.
  89. *
  90. * @param year the extended year
  91. * @param month the month
  92. * @param day the day
  93. * @param jdEpochOffset the epoch offset from Julian epoch
  94. * @return Julian day
  95. * @internal
  96. */
  97. static int32_t ceToJD(int32_t year, int32_t month, int32_t date,
  98. int32_t jdEpochOffset);
  99. /**
  100. * Convert a Julian day to an Coptic/Ethiopic year, month and day
  101. *
  102. * @param julianDay the Julian day
  103. * @param jdEpochOffset the epoch offset from Julian epoch
  104. * @param year receives the extended year
  105. * @param month receives the month
  106. * @param date receives the day
  107. * @internal
  108. */
  109. static void jdToCE(int32_t julianDay, int32_t jdEpochOffset,
  110. int32_t& year, int32_t& month, int32_t& day);
  111. };
  112. U_NAMESPACE_END
  113. #endif /* #if !UCONFIG_NO_FORMATTING */
  114. #endif
  115. //eof