2 using System.Runtime.InteropServices;
3 using System.Reflection.Emit;
7 namespace DBus.DBusType
10 /// Marks a "void"/"unset"/"nonexistent"/"null" argument.
12 public class Nil : IDBusType
14 public const char Code = 'v';
20 public Nil(object nil, Service service)
24 public Nil(IntPtr iter, Service service)
28 public void Append(IntPtr iter)
30 if (!dbus_message_iter_append_nil(iter))
31 throw new ApplicationException("Failed to append NIL argument");
34 public static bool Suits(System.Type type)
39 public static void EmitMarshalIn(ILGenerator generator, Type type)
42 generator.Emit(OpCodes.Ldind_I1);
46 public static void EmitMarshalOut(ILGenerator generator, Type type, bool isReturn)
48 generator.Emit(OpCodes.Unbox, type);
49 generator.Emit(OpCodes.Ldind_I1);
51 generator.Emit(OpCodes.Stind_I1);
60 public object Get(System.Type type)
62 throw new ArgumentException("Cannot cast DBus.Type.Nil to type '" + type.ToString() + "'");
66 private extern static bool dbus_message_iter_append_nil(IntPtr iter);