diff options
author | Owen Fraser-Green <owen@discobabe.net> | 2004-03-23 12:10:32 +0000 |
---|---|---|
committer | Owen Fraser-Green <owen@discobabe.net> | 2004-03-23 12:10:32 +0000 |
commit | c916037773d7d3d8d37ca2c5a8899b7b728e377d (patch) | |
tree | 21c37372ab9795583e724e8459578b7fe0be330b /mono/Error.cs | |
parent | 2195cf0dbde2ae26b5a684c6d914c1711f44c28d (diff) |
First checkin of the Mono bindings.
Diffstat (limited to 'mono/Error.cs')
-rw-r--r-- | mono/Error.cs | 53 |
1 files changed, 42 insertions, 11 deletions
diff --git a/mono/Error.cs b/mono/Error.cs index dab4df1f..d89a013a 100644 --- a/mono/Error.cs +++ b/mono/Error.cs @@ -1,29 +1,60 @@ -namespace DBus { - +namespace DBus +{ + using System; using System.Runtime.InteropServices; + using System.Diagnostics; // FIXME add code to verify that size of DBus.Error // matches the C code. - + [StructLayout (LayoutKind.Sequential)] - internal struct Error { + internal struct Error + { internal IntPtr name; internal IntPtr message; private int dummies; private IntPtr padding1; - - internal void Init () { - dbus_error_init (ref this); + + public void Init() + { + dbus_error_init(ref this); + } + + public void Free() + { + dbus_error_free(ref this); } - internal void Free () { - dbus_error_free (ref this); + public string Message + { + get + { + return System.Runtime.InteropServices.Marshal.PtrToStringAnsi(message); + } } - [DllImport (DBus.Internals.DBusLibname, EntryPoint="dbus_error_init")] + public string Name + { + get + { + return System.Runtime.InteropServices.Marshal.PtrToStringAnsi(name); + } + } + + public bool IsSet + { + get + { + return (name != IntPtr.Zero); + } + } + + + [DllImport ("dbus-1", EntryPoint="dbus_error_init")] private extern static void dbus_error_init (ref Error error); - [DllImport (DBus.Internals.DBusLibname, EntryPoint="dbus_error_free")] + + [DllImport ("dbus-1", EntryPoint="dbus_error_free")] private extern static void dbus_error_free (ref Error error); } } |