dbus/mono/DBusType Byte.cs, 1.3, 1.4 Int32.cs, 1.2, 1.3 Int64.cs, 1.2, 1.3 UInt32.cs, 1.2, 1.3 UInt64.cs, 1.2, 1.3

Owen Fraser-Green ow3n at pdx.freedesktop.org
Thu Mar 25 06:04:45 PST 2004


Update of /cvs/dbus/dbus/mono/DBusType
In directory pdx:/tmp/cvs-serv4667/DBusType

Modified Files:
	Byte.cs Int32.cs Int64.cs UInt32.cs UInt64.cs 
Log Message:
Added support for enumerations with marshalling to/from their underlying system type (Byte, Int32, UInt32, Int64, UInt64)


Index: Byte.cs
===================================================================
RCS file: /cvs/dbus/dbus/mono/DBusType/Byte.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- a/Byte.cs	24 Mar 2004 17:02:08 -0000	1.3
+++ b/Byte.cs	25 Mar 2004 14:04:43 -0000	1.4
@@ -41,6 +41,10 @@
 
     public static bool Suits(System.Type type) 
     {
+      if (type.IsEnum && type.UnderlyingSystemType == typeof(System.Byte)) {
+	return true;
+      }
+
       switch (type.ToString()) {
       case "System.Byte":
       case "System.Byte&":
@@ -75,6 +79,10 @@
 
     public object Get(System.Type type)
     {
+      if (type.IsEnum) {
+	return Enum.ToObject(type, this.val);
+      }
+
       switch (type.ToString()) {
       case "System.Byte":
       case "System.Byte&":

Index: Int32.cs
===================================================================
RCS file: /cvs/dbus/dbus/mono/DBusType/Int32.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- a/Int32.cs	24 Mar 2004 13:15:20 -0000	1.2
+++ b/Int32.cs	25 Mar 2004 14:04:43 -0000	1.3
@@ -36,11 +36,14 @@
 
     public static bool Suits(System.Type type) 
     {
+      if (type.IsEnum && type.UnderlyingSystemType == typeof(System.Int32)) {
+	return true;
+      }
+      
       switch (type.ToString()) {
       case "System.Int32":
       case "System.Int32&":
-	return true;
-      }
+	return true;      }
       
       return false;
     }
@@ -68,6 +71,10 @@
 
     public object Get(System.Type type)
     {
+      if (type.IsEnum) {
+	return Enum.ToObject(type, this.val);
+      }
+      
       switch (type.ToString()) {
       case "System.Int32":
       case "System.Int32&":

Index: Int64.cs
===================================================================
RCS file: /cvs/dbus/dbus/mono/DBusType/Int64.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- a/Int64.cs	24 Mar 2004 13:15:20 -0000	1.2
+++ b/Int64.cs	25 Mar 2004 14:04:43 -0000	1.3
@@ -36,6 +36,10 @@
 
     public static bool Suits(System.Type type) 
     {
+      if (type.IsEnum && type.UnderlyingSystemType == typeof(System.Int64)) {
+	return true;
+      }
+
       switch (type.ToString()) {
       case "System.Int64":
       case "System.Int64&":
@@ -68,6 +72,10 @@
 
     public object Get(System.Type type)
     {
+      if (type.IsEnum) {
+	return Enum.ToObject(type, this.val);
+      }
+
       switch (type.ToString()) {
       case "System.Int64":
       case "System.Int64&":

Index: UInt32.cs
===================================================================
RCS file: /cvs/dbus/dbus/mono/DBusType/UInt32.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- a/UInt32.cs	24 Mar 2004 13:15:20 -0000	1.2
+++ b/UInt32.cs	25 Mar 2004 14:04:43 -0000	1.3
@@ -36,6 +36,10 @@
 
     public static bool Suits(System.Type type) 
     {
+      if (type.IsEnum && type.UnderlyingSystemType == typeof(System.UInt32)) {
+	return true;
+      }
+
       switch (type.ToString()) {
       case "System.UInt32":
       case "System.UInt32&":
@@ -68,6 +72,10 @@
 
     public object Get(System.Type type)
     {
+      if (type.IsEnum) {
+	return Enum.ToObject(type, this.val);
+      }
+
       switch (type.ToString()) 
 	{
 	case "System.UInt32":

Index: UInt64.cs
===================================================================
RCS file: /cvs/dbus/dbus/mono/DBusType/UInt64.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- a/UInt64.cs	24 Mar 2004 13:15:20 -0000	1.2
+++ b/UInt64.cs	25 Mar 2004 14:04:43 -0000	1.3
@@ -36,6 +36,10 @@
 
     public static bool Suits(System.Type type) 
     {
+      if (type.IsEnum && type.UnderlyingSystemType == typeof(System.UInt64)) {
+	return true;
+      }
+
       switch (type.ToString()) {
       case "System.UInt64":
       case "System.UInt64&":
@@ -68,6 +72,10 @@
 
     public object Get(System.Type type)
     {
+      if (type.IsEnum) {
+	return Enum.ToObject(type, this.val);
+      }
+
       switch (type.ToString()) 
 	{
 	case "System.UInt64":




More information about the dbus-commit mailing list