Merge pull request #303 from ermshiperete/5278
[mono.git] / mcs / class / corlib / System.Globalization / TaiwanCalendar.cs
index 495abb9369778acf0bca81b0f39d0daf667e9d79..4b2de2db723d7ee7b7edbc731141108ac70f2093 100644 (file)
@@ -1,4 +1,4 @@
-// TaiwanCalendar.cs
+// System.Globalization.TaiwanCalendar.cs
 //
 // (C) Ulrich Kunitz 2002
 //
@@ -29,6 +29,7 @@
 namespace System.Globalization {
 
 using System;
+using System.Runtime.InteropServices;
 
 /// <summary>
 /// This is the Japanese calendar. It differs from the Gregorian calendar
@@ -41,11 +42,9 @@ using System;
 /// <see cref="N:CalendricalCalculations"/> namespace.
 /// </para>
 /// </remarks>
-#if NET_2_0
 [System.Runtime.InteropServices.ComVisible(true)]
-#endif
 [Serializable]
-[MonoTODO ("Fix serialization compatibility with MS.NET")]
+[MonoLimitation ("Serialization format not compatible with.NET")]
 public class TaiwanCalendar : Calendar {
        /// <summary>
        /// Static protected field storing the
@@ -80,8 +79,6 @@ public class TaiwanCalendar : Calendar {
                }
        }
 
-       int twoDigitYearMax = 99;
-       
        public override int TwoDigitYearMax 
        {
                get {
@@ -207,226 +204,6 @@ public class TaiwanCalendar : Calendar {
                        GetDaysInMonth(year, month, era));
                return gregorianYear;
        }
-
-#if false
-
-       // Ifdefed out because this is not on the .NET Framework
-       
-       /// <summary>
-       /// Overridden. Adds days to a given date.
-       /// </summary>
-       /// <param name="time">The
-       /// <see cref="T:System.DateTime"/> to which to add
-       /// days.
-       /// </param>
-       /// <param name="days">The number of days to add.</param>
-       /// <returns>A new <see cref="T:System.DateTime"/> value, that
-       /// results from adding <paramref name="days"/> to the specified
-       /// DateTime.</returns>
-       /// <exception cref="T:System.ArgumentOutOfRangeException">
-       /// The exception is thrown if the
-       /// <see cref="T:System.DateTime"/> return value is outside all
-       /// supported eras.
-       /// </exception>
-       public override DateTime AddDays(DateTime time, int days) {
-               DateTime t = base.AddDays(time, days);
-               M_CheckDateTime(t);
-               return t;
-       }
-
-       /// <summary>
-       /// Overridden. Adds hours to a given date.
-       /// </summary>
-       /// <param name="time">The
-       /// <see cref="T:System.DateTime"/> to which to add
-       /// hours.
-       /// </param>
-       /// <param name="hours">The number of hours to add.</param>
-       /// <returns>A new <see cref="T:System.DateTime"/> value, that
-       /// results from adding <paramref name="hours"/> to the specified
-       /// DateTime.</returns>
-       /// <exception cref="T:System.ArgumentOutOfRangeException">
-       /// The exception is thrown if the
-       /// <see cref="T:System.DateTime"/> return value is outside all
-       /// supported eras.
-       /// </exception>
-       public override DateTime AddHours(DateTime time, int hours) {
-               DateTime t = base.AddHours(time, hours);
-               M_CheckDateTime(t);
-               return t;
-       }
-
-       /// <summary>
-       /// Overridden. Adds milliseconds to a given date.
-       /// </summary>
-       /// <param name="time">The
-       /// <see cref="T:System.DateTime"/> to which to add
-       /// milliseconds.
-       /// </param>
-       /// <param name="milliseconds">The number of milliseconds given as
-       /// double to add. Keep in mind the 100 nanosecond resolution of 
-       /// <see cref="T:System.DateTime"/>.
-       /// </param>
-       /// <returns>A new <see cref="T:System.DateTime"/> value, that
-       /// results from adding <paramref name="milliseconds"/> to the specified
-       /// DateTime.</returns>
-       /// <exception cref="T:System.ArgumentOutOfRangeException">
-       /// The exception is thrown if the
-       /// <see cref="T:System.DateTime"/> return value is outside all
-       /// supported eras.
-       /// </exception>
-       public override DateTime AddMilliseconds(DateTime time,
-               double milliseconds)
-       {
-               DateTime t = base.AddMilliseconds(time, milliseconds);
-               M_CheckDateTime(t);
-               return t;
-       }
-
-       /// <summary>
-       /// Overridden. Adds minutes to a given date.
-       /// </summary>
-       /// <param name="time">The
-       /// <see cref="T:System.DateTime"/> to which to add
-       /// minutes.
-       /// </param>
-       /// <param name="minutes">The number of minutes to add.</param>
-       /// <returns>A new <see cref="T:System.DateTime"/> value, that
-       /// results from adding <paramref name="minutes"/> to the specified
-       /// DateTime.</returns>
-       /// <exception cref="T:System.ArgumentOutOfRangeException">
-       /// The exception is thrown if the
-       /// <see cref="T:System.DateTime"/> return value is outside all
-       /// supported eras.
-       /// </exception>
-       public override DateTime AddMinutes(DateTime time, int minutes) {
-               DateTime t = base.AddMinutes(time, minutes);
-               M_CheckDateTime(t);
-               return t;
-       }
-
-       /// <summary>
-       /// Overridden. Adds seconds to a given date.
-       /// </summary>
-       /// <param name="time">The
-       /// <see cref="T:System.DateTime"/> to which to add
-       /// seconds.
-       /// </param>
-       /// <param name="seconds">The number of seconds to add.</param>
-       /// <returns>A new <see cref="T:System.DateTime"/> value, that
-       /// results from adding <paramref name="seconds"/> to the specified
-       /// DateTime.</returns>
-       /// <exception cref="T:System.ArgumentOutOfRangeException">
-       /// The exception is thrown if the
-       /// <see cref="T:System.DateTime"/> return value is outside all
-       /// supported eras.
-       /// </exception>
-       public override DateTime AddSeconds(DateTime time, int seconds) {
-               DateTime t = base.AddSeconds(time, seconds);
-               M_CheckDateTime(t);
-               return t;
-       }
-
-
-       /// <summary>
-       /// Overridden. Adds weeks to a given date.
-       /// </summary>
-       /// <param name="time">The
-       /// <see cref="T:System.DateTime"/> to which to add
-       /// weeks.
-       /// </param>
-       /// <param name="weeks">The number of weeks to add.</param>
-       /// <returns>A new <see cref="T:System.DateTime"/> value, that
-       /// results from adding <paramref name="weeks"/> to the specified
-       /// DateTime.</returns>
-       /// <exception cref="T:System.ArgumentOutOfRangeException">
-       /// The exception is thrown if the
-       /// <see cref="T:System.DateTime"/> return value is outside all
-       /// supported eras.
-       /// </exception>
-       public override DateTime AddWeeks(DateTime time, int weeks) {
-               DateTime t = base.AddWeeks(time, weeks);
-               M_CheckDateTime(t);
-               return t;
-       }
-
-       /// <summary>
-       /// Overridden. Gives the hour of the specified time.
-       /// </summary>
-       /// <param name="time">The
-       /// <see cref="T:System.DateTime"/> that specifies the
-       /// time.
-       /// </param>
-       /// <returns>An integer that gives the hour of the specified time,
-       /// starting with 0.</returns>
-       /// <exception cref="T:System.ArgumentOutOfRangeException">
-       /// The exception is thrown if the
-       /// <see cref="T:System.DateTime"/> parameter is outside all
-       /// supported eras.
-       /// </exception>
-       public override int GetHour(DateTime time) {
-               M_CheckDateTime(time);
-               return base.GetHour(time);
-       }
-
-       /// <summary>
-       /// Overridden. Gives the milliseconds in the current second
-       /// of the specified time.
-       /// </summary>
-       /// <param name="time">The
-       /// <see cref="T:System.DateTime"/> that specifies the
-       /// time.
-       /// </param>
-       /// <returns>An integer that gives the milliseconds in the seconds
-       /// of the specified time, starting with 0.</returns>
-       /// <exception cref="T:System.ArgumentOutOfRangeException">
-       /// The exception is thrown if the
-       /// <see cref="T:System.DateTime"/> parameter is outside all
-       /// supported eras.
-       /// </exception>
-       public override double GetMilliseconds(DateTime time) {
-               M_CheckDateTime(time);
-               return base.GetMilliseconds(time);
-       }
-
-       /// <summary>
-       /// Overridden. Gives the minute of the specified time.
-       /// </summary>
-       /// <param name="time">The
-       /// <see cref="T:System.DateTime"/> that specifies the
-       /// time.
-       /// </param>
-       /// <returns>An integer that gives the minute of the specified time,
-       /// starting with 0.</returns>
-       /// <exception cref="T:System.ArgumentOutOfRangeException">
-       /// The exception is thrown if the
-       /// <see cref="T:System.DateTime"/> parameter is outside all
-       /// supported eras.
-       /// </exception>
-       public override int GetMinute(DateTime time) {
-               M_CheckDateTime(time);
-               return base.GetMinute(time);
-       }
-
-       /// <summary>
-       /// Overridden. Gives the second of the specified time.
-       /// </summary>
-       /// <param name="time">The
-       /// <see cref="T:System.DateTime"/> that specifies the
-       /// time.
-       /// </param>
-       /// <returns>An integer that gives the second of the specified time,
-       /// starting with 0.</returns>
-       /// <exception cref="T:System.ArgumentOutOfRangeException">
-       /// The exception is thrown if the
-       /// <see cref="T:System.DateTime"/> parameter is outside all
-       /// supported eras.
-       /// </exception>
-       public override int GetSecond(DateTime time) {
-               M_CheckDateTime(time);
-               return base.GetMinute(time);
-       }
-#endif
        
        /// <summary>
        /// Overrideden. Adds months to a given date.
@@ -597,6 +374,12 @@ public class TaiwanCalendar : Calendar {
                return era;
        }
 
+       [ComVisible (false)]
+       public override int GetLeapMonth (int year, int era)
+       {
+               return 0;
+       }
+
        /// <summary>
        /// Overridden. Gives the number of the month of the specified
        /// date.
@@ -635,6 +418,12 @@ public class TaiwanCalendar : Calendar {
                return 12;
        }
 
+       [ComVisible (false)]
+       public override int GetWeekOfYear (DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
+       {
+               return base.GetWeekOfYear (time, rule, firstDayOfWeek);
+       }
+
        /// <summary>
        /// Overridden. Gives the number of the year of the specified
        /// date.
@@ -758,14 +547,14 @@ public class TaiwanCalendar : Calendar {
        /// is out of range.
        /// </exception>
        public override DateTime ToDateTime(int year, int month, int day,
-               int hour, int minute, int second, int milliseconds,
+               int hour, int minute, int second, int millisecond,
                int era)
        {
                int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
-               M_CheckHMSM(hour, minute, second, milliseconds);
+               M_CheckHMSM(hour, minute, second, millisecond);
                return CCGregorianCalendar.ToDateTime(
                        gregorianYear, month, day,
-                       hour, minute, second, milliseconds);
+                       hour, minute, second, millisecond);
        }
 
        /// <summary>
@@ -787,29 +576,32 @@ public class TaiwanCalendar : Calendar {
                M_CheckYE(year, ref era);
                return year;
        }
-#if NET_2_0
+
+#if !NET_2_1
+       [ComVisible (false)]
        public override CalendarAlgorithmType AlgorithmType {
                get {
                        return CalendarAlgorithmType.SolarCalendar;
                }
        }
+#endif
 
        static DateTime TaiwanMin = new DateTime (1912, 1, 1, 0, 0, 0);
        static DateTime TaiwanMax = new DateTime (9999, 12, 31, 11, 59, 59);
                
+       [ComVisible (false)]
        public override DateTime MinSupportedDateTime {
                get {
                        return TaiwanMin;
                }
        }
 
+       [ComVisible (false)]
        public override DateTime MaxSupportedDateTime {
                get {
                        return TaiwanMax;
                }
        }
-#endif
-       
 } // class TaiwanCalendar
        
 } // namespace System.Globalization