00001 using System;
00002 using System.Runtime.InteropServices;
00003 using System.Reflection.Emit;
00004
00005 using DBus;
00006
00007 namespace DBus.DBusType
00008 {
00012 public class Nil : IDBusType
00013 {
00014 public const char Code = 'v';
00015
00016 private Nil()
00017 {
00018 }
00019
00020 public Nil(object nil, Service service)
00021 {
00022 }
00023
00024 public Nil(IntPtr iter, Service service)
00025 {
00026 }
00027
00028 public void Append(IntPtr iter)
00029 {
00030 if (!dbus_message_iter_append_nil(iter))
00031 throw new ApplicationException("Failed to append NIL argument");
00032 }
00033
00034 public static bool Suits(System.Type type)
00035 {
00036 return false;
00037 }
00038
00039 public static void EmitMarshalIn(ILGenerator generator, Type type)
00040 {
00041 if (type.IsByRef) {
00042 generator.Emit(OpCodes.Ldind_I1);
00043 }
00044 }
00045
00046 public static void EmitMarshalOut(ILGenerator generator, Type type, bool isReturn)
00047 {
00048 generator.Emit(OpCodes.Unbox, type);
00049 generator.Emit(OpCodes.Ldind_I1);
00050 if (!isReturn) {
00051 generator.Emit(OpCodes.Stind_I1);
00052 }
00053 }
00054
00055 public object Get()
00056 {
00057 return null;
00058 }
00059
00060 public object Get(System.Type type)
00061 {
00062 throw new ArgumentException("Cannot cast DBus.Type.Nil to type '" + type.ToString() + "'");
00063 }
00064
00065 [DllImport("dbus-1")]
00066 private extern static bool dbus_message_iter_append_nil(IntPtr iter);
00067 }
00068 }