summaryrefslogtreecommitdiffstats
path: root/mono/DBusType
diff options
context:
space:
mode:
authorOwen Fraser-Green <owen@discobabe.net>2004-03-24 13:15:20 +0000
committerOwen Fraser-Green <owen@discobabe.net>2004-03-24 13:15:20 +0000
commitf33453896716e69cacd0d065b7cc633258678946 (patch)
treeed10e70ef8b1cb259a5d58afa276ef1ba94af56c /mono/DBusType
parent93aa62035612121523adf1ba47c27dd22866cb25 (diff)
Made all DBusTypes take Service in the constructor because Array also needed it in the case of an array of OBJECT_PATH objects.
Diffstat (limited to 'mono/DBusType')
-rw-r--r--mono/DBusType/Array.cs14
-rw-r--r--mono/DBusType/Boolean.cs4
-rw-r--r--mono/DBusType/Byte.cs4
-rw-r--r--mono/DBusType/Custom.cs4
-rw-r--r--mono/DBusType/Dict.cs4
-rw-r--r--mono/DBusType/Double.cs4
-rw-r--r--mono/DBusType/Int32.cs4
-rw-r--r--mono/DBusType/Int64.cs4
-rw-r--r--mono/DBusType/Nil.cs4
-rw-r--r--mono/DBusType/ObjectPath.cs19
-rw-r--r--mono/DBusType/String.cs4
-rw-r--r--mono/DBusType/UInt32.cs4
-rw-r--r--mono/DBusType/UInt64.cs4
13 files changed, 36 insertions, 41 deletions
diff --git a/mono/DBusType/Array.cs b/mono/DBusType/Array.cs
index 3bce3afa..34a842c7 100644
--- a/mono/DBusType/Array.cs
+++ b/mono/DBusType/Array.cs
@@ -16,19 +16,23 @@ namespace DBus.DBusType
private System.Array val;
private ArrayList elements;
private Type elementType;
+ private Service service = null;
private Array()
{
}
- public Array(System.Array val)
+ public Array(System.Array val, Service service)
{
this.val = val;
this.elementType = Arguments.MatchType(val.GetType().UnderlyingSystemType);
+ this.service = service;
}
- public Array(IntPtr iter)
+ public Array(IntPtr iter, Service service)
{
+ this.service = service;
+
IntPtr arrayIter = Marshal.AllocCoTaskMem(Arguments.DBusMessageIterSize);
int elementTypeCode;
@@ -38,8 +42,9 @@ namespace DBus.DBusType
elements = new ArrayList();
do {
- object [] pars = new Object[1];
+ object [] pars = new Object[2];
pars[0] = arrayIter;
+ pars[1] = service;
DBusType.IDBusType dbusType = (DBusType.IDBusType) Activator.CreateInstance(elementType, pars);
elements.Add(dbusType);
} while (dbus_message_iter_next(arrayIter));
@@ -58,8 +63,9 @@ namespace DBus.DBusType
}
foreach (object element in this.val) {
- object [] pars = new Object[1];
+ object [] pars = new Object[2];
pars[0] = element;
+ pars[1] = this.service;
DBusType.IDBusType dbusType = (DBusType.IDBusType) Activator.CreateInstance(elementType, pars);
dbusType.Append(arrayIter);
}
diff --git a/mono/DBusType/Boolean.cs b/mono/DBusType/Boolean.cs
index ef8ed498..fa5e1bcf 100644
--- a/mono/DBusType/Boolean.cs
+++ b/mono/DBusType/Boolean.cs
@@ -18,12 +18,12 @@ namespace DBus.DBusType
{
}
- public Boolean(System.Boolean val)
+ public Boolean(System.Boolean val, Service service)
{
this.val = val;
}
- public Boolean(IntPtr iter)
+ public Boolean(IntPtr iter, Service service)
{
this.val = dbus_message_iter_get_boolean(iter);
}
diff --git a/mono/DBusType/Byte.cs b/mono/DBusType/Byte.cs
index eaffd26e..1e083a99 100644
--- a/mono/DBusType/Byte.cs
+++ b/mono/DBusType/Byte.cs
@@ -18,12 +18,12 @@ namespace DBus.DBusType
{
}
- public Byte(System.Byte val)
+ public Byte(System.Byte val, Service service)
{
this.val = val;
}
- public Byte(IntPtr iter)
+ public Byte(IntPtr iter, Service service)
{
this.val = dbus_message_iter_get_byte(iter);
}
diff --git a/mono/DBusType/Custom.cs b/mono/DBusType/Custom.cs
index d3eb7629..92560649 100644
--- a/mono/DBusType/Custom.cs
+++ b/mono/DBusType/Custom.cs
@@ -18,12 +18,12 @@ namespace DBus.DBusType
{
}
- public Custom(DBus.Custom val)
+ public Custom(DBus.Custom val, Service service)
{
this.val = val;
}
- public Custom(IntPtr iter)
+ public Custom(IntPtr iter, Service service)
{
string name;
IntPtr value;
diff --git a/mono/DBusType/Dict.cs b/mono/DBusType/Dict.cs
index e6fce159..bd649434 100644
--- a/mono/DBusType/Dict.cs
+++ b/mono/DBusType/Dict.cs
@@ -19,7 +19,7 @@ namespace DBus.DBusType
{
}
- public Dict(IDictionary val)
+ public Dict(IDictionary val, Service service)
{
this.val = new Hashtable();
foreach (DictionaryEntry entry in val) {
@@ -27,7 +27,7 @@ namespace DBus.DBusType
}
}
- public Dict(IntPtr iter)
+ public Dict(IntPtr iter, Service service)
{
IntPtr dictIter = Marshal.AllocCoTaskMem(Arguments.DBusMessageIterSize);
diff --git a/mono/DBusType/Double.cs b/mono/DBusType/Double.cs
index d578822f..008f6824 100644
--- a/mono/DBusType/Double.cs
+++ b/mono/DBusType/Double.cs
@@ -18,12 +18,12 @@ namespace DBus.DBusType
{
}
- public Double(System.Double val)
+ public Double(System.Double val, Service service)
{
this.val = val;
}
- public Double(IntPtr iter)
+ public Double(IntPtr iter, Service service)
{
this.val = dbus_message_iter_get_double(iter);
}
diff --git a/mono/DBusType/Int32.cs b/mono/DBusType/Int32.cs
index b617a9a0..be78eba8 100644
--- a/mono/DBusType/Int32.cs
+++ b/mono/DBusType/Int32.cs
@@ -18,12 +18,12 @@ namespace DBus.DBusType
{
}
- public Int32(System.Int32 val)
+ public Int32(System.Int32 val, Service service)
{
this.val = val;
}
- public Int32(IntPtr iter)
+ public Int32(IntPtr iter, Service service)
{
this.val = dbus_message_iter_get_int32(iter);
}
diff --git a/mono/DBusType/Int64.cs b/mono/DBusType/Int64.cs
index 0905af74..1cc79c7c 100644
--- a/mono/DBusType/Int64.cs
+++ b/mono/DBusType/Int64.cs
@@ -18,12 +18,12 @@ namespace DBus.DBusType
{
}
- public Int64(System.Int64 val)
+ public Int64(System.Int64 val, Service service)
{
this.val = val;
}
- public Int64(IntPtr iter)
+ public Int64(IntPtr iter, Service service)
{
this.val = dbus_message_iter_get_int64(iter);
}
diff --git a/mono/DBusType/Nil.cs b/mono/DBusType/Nil.cs
index e39b64a9..a271db3d 100644
--- a/mono/DBusType/Nil.cs
+++ b/mono/DBusType/Nil.cs
@@ -17,11 +17,11 @@ namespace DBus.DBusType
{
}
- public Nil(object nil)
+ public Nil(object nil, Service service)
{
}
- public Nil(IntPtr iter)
+ public Nil(IntPtr iter, Service service)
{
}
diff --git a/mono/DBusType/ObjectPath.cs b/mono/DBusType/ObjectPath.cs
index 6e03e2d1..40460bbf 100644
--- a/mono/DBusType/ObjectPath.cs
+++ b/mono/DBusType/ObjectPath.cs
@@ -20,19 +20,16 @@ namespace DBus.DBusType
{
}
- public ObjectPath(object val)
+ public ObjectPath(object val, Service service)
{
this.val = val;
+ this.service = service;
}
- public ObjectPath(IntPtr iter)
+ public ObjectPath(IntPtr iter, Service service)
{
this.pathName = Marshal.PtrToStringAnsi(dbus_message_iter_get_object_path(iter));
- }
-
- public void SetService(Service service)
- {
this.service = service;
}
@@ -43,17 +40,13 @@ namespace DBus.DBusType
Handler handler = this.service.GetHandler(this.val);
this.pathName = handler.PathName;
}
-
+
return this.pathName;
}
}
public void Append(IntPtr iter)
{
- if (PathName == null) {
- throw new ApplicationException("Unable to append ObjectPath before calling SetService()");
- }
-
if (!dbus_message_iter_append_object_path(iter, Marshal.StringToHGlobalAnsi(PathName)))
throw new ApplicationException("Failed to append OBJECT_PATH argument:" + val);
}
@@ -90,10 +83,6 @@ namespace DBus.DBusType
public object Get(System.Type type)
{
- if (this.service == null) {
- throw new ApplicationException("Unable to get ObjectPath before calling SetService()");
- }
-
try {
return this.service.GetObject(type, PathName);
} catch(Exception ex) {
diff --git a/mono/DBusType/String.cs b/mono/DBusType/String.cs
index 1eda1f25..bced310a 100644
--- a/mono/DBusType/String.cs
+++ b/mono/DBusType/String.cs
@@ -18,12 +18,12 @@ namespace DBus.DBusType
{
}
- public String(string val)
+ public String(string val, Service service)
{
this.val = val;
}
- public String(IntPtr iter)
+ public String(IntPtr iter, Service service)
{
this.val = Marshal.PtrToStringAnsi(dbus_message_iter_get_string(iter));
}
diff --git a/mono/DBusType/UInt32.cs b/mono/DBusType/UInt32.cs
index 9c0e350a..43753511 100644
--- a/mono/DBusType/UInt32.cs
+++ b/mono/DBusType/UInt32.cs
@@ -18,12 +18,12 @@ namespace DBus.DBusType
{
}
- public UInt32(System.UInt32 val)
+ public UInt32(System.UInt32 val, Service service)
{
this.val = val;
}
- public UInt32(IntPtr iter)
+ public UInt32(IntPtr iter, Service service)
{
this.val = dbus_message_iter_get_uint32(iter);
}
diff --git a/mono/DBusType/UInt64.cs b/mono/DBusType/UInt64.cs
index 2e474795..7bcccaee 100644
--- a/mono/DBusType/UInt64.cs
+++ b/mono/DBusType/UInt64.cs
@@ -18,12 +18,12 @@ namespace DBus.DBusType
{
}
- public UInt64(System.UInt64 val)
+ public UInt64(System.UInt64 val, Service service)
{
this.val = val;
}
- public UInt64(IntPtr iter)
+ public UInt64(IntPtr iter, Service service)
{
this.val = dbus_message_iter_get_uint64(iter);
}