dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dotgnu-pnet-commits] pnetlib ChangeLog runtime/System/Collections/Ge...


From: Klaus Treichel
Subject: [dotgnu-pnet-commits] pnetlib ChangeLog runtime/System/Collections/Ge...
Date: Sun, 05 Oct 2008 20:29:48 +0000

CVSROOT:        /cvsroot/dotgnu-pnet
Module name:    pnetlib
Changes by:     Klaus Treichel <ktreichel>      08/10/05 20:29:48

Modified files:
        .              : ChangeLog 
        runtime/System/Collections/Generic: ICollection_1.cs IList_1.cs 
Added files:
        runtime/System : Nullable.cs Nullable_1.cs 

Log message:
        Enable build of more generic interfaces and add nullable classes.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnetlib/ChangeLog?cvsroot=dotgnu-pnet&r1=1.2543&r2=1.2544
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/Collections/Generic/ICollection_1.cs?cvsroot=dotgnu-pnet&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/Collections/Generic/IList_1.cs?cvsroot=dotgnu-pnet&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/Nullable.cs?cvsroot=dotgnu-pnet&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/Nullable_1.cs?cvsroot=dotgnu-pnet&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/ChangeLog,v
retrieving revision 1.2543
retrieving revision 1.2544
diff -u -b -r1.2543 -r1.2544
--- ChangeLog   3 Oct 2008 09:39:28 -0000       1.2543
+++ ChangeLog   5 Oct 2008 20:29:47 -0000       1.2544
@@ -1,3 +1,12 @@
+2008-10-05  Klaus Treichel  <address@hidden>
+
+       * runtime/System/Nullable.cs, runtime/System/Nullable_1.cs: Add support
+       for nullable structs.
+
+       * runtime/System/Collections/Generic/ICollection_1.cs,
+       runtime/System/Collections/Generic/IList_1.cs: Build these interfaces 
now
+       too with CONFIG_FRAMEWORK_2_0.
+
 2008-10-03  Klaus Treichel  <address@hidden>
 
        * runtime/System/Action_1.cs, runtime/System/Comparision_1.cs,

Index: runtime/System/Collections/Generic/ICollection_1.cs
===================================================================
RCS file: 
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Collections/Generic/ICollection_1.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- runtime/System/Collections/Generic/ICollection_1.cs 2 Oct 2008 20:20:01 
-0000       1.1
+++ runtime/System/Collections/Generic/ICollection_1.cs 5 Oct 2008 20:29:47 
-0000       1.2
@@ -22,7 +22,7 @@
 namespace System.Collections.Generic
 {
 
-#if CONFIG_FRAMEWORK_2_0 && CONFIG_GENERICS
+#if CONFIG_FRAMEWORK_2_0
 
 public interface ICollection<T> : IEnumerable<T>
 {
@@ -36,6 +36,6 @@
 
 }; // interface ICollection<T>
 
-#endif // CONFIG_FRAMEWORK_2_0 && CONFIG_GENERICS
+#endif // CONFIG_FRAMEWORK_2_0
 
 }; // namespace System.Collections.Generic

Index: runtime/System/Collections/Generic/IList_1.cs
===================================================================
RCS file: 
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Collections/Generic/IList_1.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- runtime/System/Collections/Generic/IList_1.cs       2 Oct 2008 20:20:06 
-0000       1.1
+++ runtime/System/Collections/Generic/IList_1.cs       5 Oct 2008 20:29:47 
-0000       1.2
@@ -22,7 +22,7 @@
 namespace System.Collections.Generic
 {
 
-#if CONFIG_FRAMEWORK_2_0 && CONFIG_GENERICS
+#if CONFIG_FRAMEWORK_2_0
 
 public interface IList<T> : ICollection<T>
 {
@@ -33,6 +33,6 @@
 
 }; // interface IList<T>
 
-#endif //  CONFIG_FRAMEWORK_2_0 && CONFIG_GENERICS
+#endif //  CONFIG_FRAMEWORK_2_0
 
 }; // namespace System.Collections.Generic

Index: runtime/System/Nullable.cs
===================================================================
RCS file: runtime/System/Nullable.cs
diff -N runtime/System/Nullable.cs
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ runtime/System/Nullable.cs  5 Oct 2008 20:29:47 -0000       1.1
@@ -0,0 +1,63 @@
+/*
+ * Nullable.cs - Implementation of the "System.Nullable" class.
+ *
+ * Copyright (C) 2008  Southern Storm Software, Pty Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+namespace System
+{
+
+#if CONFIG_FRAMEWORK_2_0 && !ECMA_COMPAT && CONFIG_GENERICS
+
+using System.Runtime.InteropServices;
+
+[ComVisible(true)]
+public static class Nullable
+{
+       [TODO]
+       [ComVisible(true)]
+       public static int Compare<T>(Nullable<T> n1, Nullable<T> n2) where T : 
struct
+                       {
+                               throw new NotImplementedExcepton();
+                       }
+
+       [ComVisible(true)]
+       public static bool Equals<T>(Nullable<T> n1, Nullable<T> n2) where T : 
struct
+                       {
+                               if(n1.HasValue != n2.HasValue)
+                               {
+                                       return false;
+                               }
+                               if(n1.HasValue)
+                               {
+                                       return n1.Value == n2.Value;
+                               }
+                               return true;
+                       }
+
+       [TODO]
+       [ComVisible(true)]
+       public static Type GetUnderlyingType(Type nullableType)
+                       {
+                               throw new NotImplementedExcepton();
+                       }
+
+}; // class Nullable
+
+#endif // CONFIG_FRAMEWORK_2_0 && !ECMA_COMPAT && CONFIG_GENERICS
+
+}; // namespace System

Index: runtime/System/Nullable_1.cs
===================================================================
RCS file: runtime/System/Nullable_1.cs
diff -N runtime/System/Nullable_1.cs
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ runtime/System/Nullable_1.cs        5 Oct 2008 20:29:47 -0000       1.1
@@ -0,0 +1,143 @@
+/*
+ * Nullable_1.cs - Implementation of the "System.Nullable<T>" class.
+ *
+ * Copyright (C) 2008  Southern Storm Software, Pty Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+namespace System
+{
+
+#if CONFIG_FRAMEWORK_2_0
+
+#if !ECMA_COMPAT && CONFIG_SERIALIZATION
+using System.Runtime.Serialization;
+
+[Serializable]
+#endif
+public struct Nullable<T> where T : struct
+{
+       private T value;
+       private bool hasValue;
+
+       public Nullable(T value)
+                       {
+                               this.value = value;
+                               hasValue = true;
+                       }
+
+       public static T FromNullable(Nullable<T> value)
+                       {
+                               if(!value.hasValue)
+                               {
+                                       throw new InvalidOperationException();
+                               }
+                               return value.value;
+                       }
+
+       public static Nullable<T> ToNullable(T value)
+                       {
+                               return new Nullable<T>(value);
+                       }
+
+       public static explicit operator T(Nullable<T> value)
+                       {
+                               if(!value.hasValue)
+                               {
+                                       throw new InvalidOperationException();
+                               }
+                               return value.value;
+                       }
+
+       public static implicit operator Nullable<T>(T value)
+                       {
+                               return new Nullable<T>(value);
+                       }
+
+       public override bool Equals(Object obj)
+                       {
+                               if(obj == null)
+                               {
+                                       return !hasValue;
+                               }
+                               if(hasValue)
+                               {
+                                       return value.Equals(obj);
+                               }
+                               return false;
+                       }
+
+       public override int GetHashCode()
+                       {
+                               if(hasValue)
+                               {
+                                       return value.GetHashCode();
+                               }
+                               return 0;
+                       }
+
+       public override string ToString()
+                       {
+                               if(hasValue)
+                               {
+                                       return value.ToString();
+                               }
+                               return String.Empty;
+                       }
+
+       public T GetValueOrDefault()
+                       {
+                               if(hasValue)
+                               {
+                                       return value;
+                               }
+                               return new T();
+                       }
+
+       public T GetValueOrDefault(T alternateDefaultValue)
+                       {
+                               if(hasValue)
+                               {
+                                       return value;
+                               }
+                               return alternateDefaultValue;
+                       }
+
+       public bool HasValue
+                       {
+                               get
+                               {
+                                       return hasValue;        
+                               }
+                       }
+
+       public T Value
+                       {
+                               get
+                               {
+                                       if(!hasValue)
+                                       {
+                                               throw new 
InvalidOperationException();
+                                       }
+                                       return value;
+                               }
+                       }
+
+}; // struct Nullable<T>
+
+#endif // CONFIG_FRAMEWORK_2_0
+
+}; // namespace System




reply via email to

[Prev in Thread] Current Thread [Next in Thread]