* qt/Makfile.am:
[platform/upstream/dbus.git] / mono / Error.cs
1 namespace DBus 
2 {
3   
4   using System;
5   using System.Runtime.InteropServices;
6   using System.Diagnostics;
7   
8   // FIXME add code to verify that size of DBus.Error
9   // matches the C code.
10   
11   [StructLayout (LayoutKind.Sequential)]
12   internal struct Error
13   {
14     internal IntPtr name;
15     internal IntPtr message;
16     private int dummies;
17     private IntPtr padding1;
18     
19     public void Init() 
20     {
21       dbus_error_init(ref this);
22     }
23     
24     public void Free() 
25     {
26       dbus_error_free(ref this);
27     }
28     
29     public string Message
30     {
31       get
32         {
33           return System.Runtime.InteropServices.Marshal.PtrToStringAnsi(message);
34         }
35     }
36     
37     public string Name
38     {
39       get
40         {
41           return System.Runtime.InteropServices.Marshal.PtrToStringAnsi(name);
42         }
43     }
44
45     public bool IsSet
46     {
47       get
48         {
49           return (name != IntPtr.Zero);
50         }
51     }
52     
53     
54     [DllImport ("dbus-1", EntryPoint="dbus_error_init")]
55     private extern static void dbus_error_init (ref Error error);
56     
57     [DllImport ("dbus-1", EntryPoint="dbus_error_free")]
58     private extern static void dbus_error_free (ref Error error);
59   }
60 }