Enable added Calendar APIS on Linux
authorTarekm Mahmoud Sayed <tarekms@microsoft.com>
Thu, 29 Sep 2016 23:48:47 +0000 (16:48 -0700)
committerTarekm Mahmoud Sayed <tarekms@microsoft.com>
Thu, 29 Sep 2016 23:48:47 +0000 (16:48 -0700)
16 files changed:
src/mscorlib/corefx/System/Globalization/Calendar.cs
src/mscorlib/corefx/System/Globalization/CalendarAlgorithmType.cs [new file with mode: 0644]
src/mscorlib/corefx/System/Globalization/EastAsianLunisolarCalendar.cs
src/mscorlib/corefx/System/Globalization/GregorianCalendar.cs
src/mscorlib/corefx/System/Globalization/HebrewCalendar.cs
src/mscorlib/corefx/System/Globalization/HijriCalendar.cs
src/mscorlib/corefx/System/Globalization/JapaneseCalendar.cs
src/mscorlib/corefx/System/Globalization/JulianCalendar.cs
src/mscorlib/corefx/System/Globalization/KoreanCalendar.cs
src/mscorlib/corefx/System/Globalization/PersianCalendar.cs
src/mscorlib/corefx/System/Globalization/STUBS.cs
src/mscorlib/corefx/System/Globalization/TaiwanCalendar.cs
src/mscorlib/corefx/System/Globalization/ThaiBuddhistCalendar.cs
src/mscorlib/corefx/System/Globalization/UmAlQuraCalendar.cs
src/mscorlib/model.xml
src/mscorlib/mscorlib.shared.sources.props

index 343682d..d8489da 100644 (file)
@@ -99,8 +99,14 @@ namespace System.Globalization
             }
         }
 
-
-
+        [System.Runtime.InteropServices.ComVisible(false)]
+        public virtual CalendarAlgorithmType AlgorithmType
+        {
+            get
+            {
+                return CalendarAlgorithmType.Unknown;
+            }
+        }
 
         protected Calendar()
         {
@@ -164,7 +170,7 @@ namespace System.Globalization
         //
         ////////////////////////////////////////////////////////////////////////
         [System.Runtime.InteropServices.ComVisible(false)]
-        internal static Calendar ReadOnly(Calendar calendar)
+        public static Calendar ReadOnly(Calendar calendar)
         {
             if (calendar == null) { throw new ArgumentNullException("calendar"); }
             Contract.EndContractBlock();
@@ -700,6 +706,16 @@ namespace System.Globalization
 
         public abstract bool IsLeapMonth(int year, int month, int era);
 
+        // Returns  the leap month in a calendar year of the current era. This method returns 0
+        // if this calendar does not have leap month, or this year is not a leap year.
+        //
+
+        [System.Runtime.InteropServices.ComVisible(false)]
+        public virtual int GetLeapMonth(int year)
+        {
+            return (GetLeapMonth(year, CurrentEra));
+        }
+
         // Returns  the leap month in a calendar year of the specified era. This method returns 0
         // if this calendar does not have leap month, or this year is not a leap year.
         //
diff --git a/src/mscorlib/corefx/System/Globalization/CalendarAlgorithmType.cs b/src/mscorlib/corefx/System/Globalization/CalendarAlgorithmType.cs
new file mode 100644 (file)
index 0000000..159b0e6
--- /dev/null
@@ -0,0 +1,20 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+
+namespace System.Globalization
+{
+    public enum CalendarAlgorithmType
+    {
+        Unknown = 0,            // This is the default value to return in the Calendar base class.
+        SolarCalendar = 1,      // Solar-base calendar, such as GregorianCalendar, jaoaneseCalendar, JulianCalendar, etc.
+                                // Solar calendars are based on the solar year and seasons.
+        LunarCalendar = 2,      // Lunar-based calendar, such as Hijri and UmAlQuraCalendar.
+                                // Lunar calendars are based on the path of the moon.  The seasons are not accurately represented.
+        LunisolarCalendar = 3   // Lunisolar-based calendar which use leap month rule, such as HebrewCalendar and Asian Lunisolar calendars.
+                                // Lunisolar calendars are based on the cycle of the moon, but consider the seasons as a secondary consideration,
+                                // so they align with the seasons as well as lunar events.
+    }
+}
index 8f2bbbc..a8319b1 100644 (file)
@@ -38,14 +38,13 @@ namespace System.Globalization
         internal const int DatePartMonth = 2;
         internal const int DatePartDay = 3;
 
-        // Return the type of the East Asian Lunisolar calendars.
-        //
-
-        //public override CalendarAlgorithmType AlgorithmType {
-        //    get {
-        //        return CalendarAlgorithmType.LunisolarCalendar;
-        //    }
-        //}
+        public override CalendarAlgorithmType AlgorithmType
+        {
+            get
+            {
+                return CalendarAlgorithmType.LunisolarCalendar;
+            }
+        }
 
         // Return the year number in the 60-year cycle.
         //
index d0933a0..1a3e592 100644 (file)
@@ -84,6 +84,15 @@ namespace System.Globalization
             }
         }
 
+        [System.Runtime.InteropServices.ComVisible(false)]
+        public override CalendarAlgorithmType AlgorithmType
+        {
+            get
+            {
+                return CalendarAlgorithmType.SolarCalendar;
+            }
+        }
+
         /*=================================GetDefaultInstance==========================
         **Action: Internal method to provide a default intance of GregorianCalendar.  Used by NLS+ implementation
         **       and other calendars.
index 5fbf2e0..0a45a26 100644 (file)
@@ -317,6 +317,14 @@ namespace System.Globalization
             }
         }
 
+        public override CalendarAlgorithmType AlgorithmType
+        {
+            get
+            {
+                return CalendarAlgorithmType.LunisolarCalendar;
+            }
+        }
+
         public HebrewCalendar()
         {
         }
index 72d9ab3..313903b 100644 (file)
@@ -48,7 +48,7 @@ namespace System.Globalization
     [System.Runtime.InteropServices.ComVisible(true)]
     public partial class HijriCalendar : Calendar
     {
-        internal static readonly int HijriEra = 1;
+        public static readonly int HijriEra = 1;
 
         internal const int DatePartYear = 0;
         internal const int DatePartDayOfYear = 1;
@@ -91,6 +91,15 @@ namespace System.Globalization
             }
         }
 
+        [System.Runtime.InteropServices.ComVisible(false)]
+        public override CalendarAlgorithmType AlgorithmType
+        {
+            get
+            {
+                return CalendarAlgorithmType.LunarCalendar;
+            }
+        }
+
         public HijriCalendar()
         {
         }
index 4130801..098d4a5 100644 (file)
@@ -68,6 +68,15 @@ namespace System.Globalization
             }
         }
 
+        [System.Runtime.InteropServices.ComVisible(false)]
+        public override CalendarAlgorithmType AlgorithmType
+        {
+            get
+            {
+                return CalendarAlgorithmType.SolarCalendar;
+            }
+        }
+
         //
         // Using a field initializer rather than a static constructor so that the whole class can be lazy
         // init.
index 6721899..9fc6525 100644 (file)
@@ -67,17 +67,14 @@ namespace System.Globalization
             }
         }
 
-        // Return the type of the Julian calendar.
-        //
-
-        //[System.Runtime.InteropServices.ComVisible(false)]
-        //public override CalendarAlgorithmType AlgorithmType
-        //{
-        //    get
-        //    {
-        //        return CalendarAlgorithmType.SolarCalendar;
-        //    }
-        //}
+        [System.Runtime.InteropServices.ComVisible(false)]
+        public override CalendarAlgorithmType AlgorithmType
+        {
+            get
+            {
+                return CalendarAlgorithmType.SolarCalendar;
+            }
+        }
 
         public JulianCalendar()
         {
index 38a0b41..ff9a693 100644 (file)
@@ -69,6 +69,15 @@ namespace System.Globalization
             }
         }
 
+        [System.Runtime.InteropServices.ComVisible(false)]
+        public override CalendarAlgorithmType AlgorithmType
+        {
+            get
+            {
+                return CalendarAlgorithmType.SolarCalendar;
+            }
+        }
+
         public KoreanCalendar()
         {
             try
index 57bef7e..28596da 100644 (file)
@@ -65,15 +65,13 @@ namespace System.Globalization
             }
         }
 
-        // Return the type of the Persian calendar.
-        //
-
-
-        //public override CalendarAlgorithmType AlgorithmType {
-        //    get {
-        //        return CalendarAlgorithmType.SolarCalendar;
-        //    }
-        //}
+        public override CalendarAlgorithmType AlgorithmType
+        {
+            get
+            {
+                return CalendarAlgorithmType.SolarCalendar;
+            }
+        }
 
         // Construct an instance of Persian calendar.
 
index 9a25adc..b3e61ea 100644 (file)
@@ -1,24 +1,5 @@
 namespace System.Globalization
 {
-    public abstract partial class Calendar : System.ICloneable
-    {
-        [System.Runtime.InteropServices.ComVisibleAttribute(false)]
-        public virtual int GetLeapMonth(int year) { throw new NotImplementedException(); }
-    }
-
-    [System.Runtime.InteropServices.ComVisible(true)]
-    public enum CalendarAlgorithmType
-    {
-        Unknown = 0,            // This is the default value to return in the Calendar base class.
-        SolarCalendar = 1,      // Solar-base calendar, such as GregorianCalendar, jaoaneseCalendar, JulianCalendar, etc.
-                                // Solar calendars are based on the solar year and seasons.
-        LunarCalendar = 2,      // Lunar-based calendar, such as Hijri and UmAlQuraCalendar.
-                                // Lunar calendars are based on the path of the moon.  The seasons are not accurately represented.
-        LunisolarCalendar = 3   // Lunisolar-based calendar which use leap month rule, such as HebrewCalendar and Asian Lunisolar calendars.
-                                // Lunisolar calendars are based on the cycle of the moon, but consider the seasons as a secondary consideration,
-                                // so they align with the seasons as well as lunar events.
-    }
-
     public partial class CompareInfo : System.Runtime.Serialization.IDeserializationCallback
     {
         public int LCID { get { throw new NotImplementedException(); } }
index 89b2e4a..72365a6 100644 (file)
@@ -83,6 +83,15 @@ namespace System.Globalization
             }
         }
 
+        [System.Runtime.InteropServices.ComVisible(false)]
+        public override CalendarAlgorithmType AlgorithmType
+        {
+            get
+            {
+                return CalendarAlgorithmType.SolarCalendar;
+            }
+        }
+
         // Return the type of the Taiwan calendar.
         //
 
index b42af30..a57160a 100644 (file)
@@ -56,6 +56,15 @@ namespace System.Globalization
             }
         }
 
+        [System.Runtime.InteropServices.ComVisible(false)]
+        public override CalendarAlgorithmType AlgorithmType
+        {
+            get
+            {
+                return CalendarAlgorithmType.SolarCalendar;
+            }
+        }
+
         public ThaiBuddhistCalendar()
         {
             helper = new GregorianCalendarHelper(this, thaiBuddhistEraInfo);
index 1116722..c825e48 100644 (file)
@@ -270,6 +270,14 @@ namespace System.Globalization
             }
         }
 
+        public override CalendarAlgorithmType AlgorithmType
+        {
+            get
+            {
+                return CalendarAlgorithmType.LunarCalendar;
+            }
+        }
+
         public UmAlQuraCalendar()
         {
         }
index 7f7169e..421c723 100644 (file)
       <Member Name="#ctor" />
       <Member Name="AddMonths(System.DateTime,System.Int32)" />
       <Member Name="AddYears(System.DateTime,System.Int32)" />
-      <Member Name="get_AlgorithmType" Condition="not FEATURE_COREFX_GLOBALIZATION" />
+      <Member Name="get_AlgorithmType" />
       <Member Name="get_Eras" />
       <Member Name="get_MaxSupportedDateTime" />
       <Member Name="get_MinSupportedDateTime" />
     <Type Name="System.Globalization.EastAsianLunisolarCalendar">
       <Member Name="AddMonths(System.DateTime,System.Int32)" />
       <Member Name="AddYears(System.DateTime,System.Int32)" />
-      <Member Name="get_AlgorithmType" Condition="not FEATURE_COREFX_GLOBALIZATION" />
+      <Member Name="get_AlgorithmType" />
       <Member Name="get_TwoDigitYearMax" />
       <Member Name="GetCelestialStem(System.Int32)" />
       <Member Name="GetDayOfMonth(System.DateTime)" />
       <Member Name="#ctor" />
       <Member Name="AddMonths(System.DateTime,System.Int32)" />
       <Member Name="AddYears(System.DateTime,System.Int32)" />
-      <Member Name="get_AlgorithmType" Condition="not FEATURE_COREFX_GLOBALIZATION" />
+      <Member Name="get_AlgorithmType" />
       <Member Name="get_Eras" />
       <Member Name="get_MaxSupportedDateTime" />
       <Member Name="get_MinSupportedDateTime" />
index 25f9be9..025c93e 100644 (file)
     <GlobalizationSources Include="$(CoreFxSourcesRoot)\SR.cs" />
     <GlobalizationSources Condition="'$(FeatureCoreClr)'=='true'" Include="$(CoreFxSourcesRoot)\System\Globalization\STUBS.cs" />
     <GlobalizationSources Include="$(CoreFxSourcesRoot)\System\Globalization\Calendar.cs" />
+    <GlobalizationSources Include="$(CoreFxSourcesRoot)\System\Globalization\CalendarAlgorithmType.cs" />
     <GlobalizationSources Include="$(CoreFxSourcesRoot)\System\Globalization\CalendarData.cs" />
     <GlobalizationSources Include="$(CoreFxSourcesRoot)\System\Globalization\CalendarWeekRule.cs" />
     <GlobalizationSources Include="$(CoreFxSourcesRoot)\System\Globalization\CalendricalCalculationsHelper.cs" />