3 * @brief LibVLC marshalling utilities
8 /**********************************************************************
9 * Copyright (C) 2007 RĂ©mi Denis-Courmont. *
10 * This program is free software; you can redistribute and/or modify *
11 * it under the terms of the GNU General Public License as published *
12 * by the Free Software Foundation; version 2 of the license, or (at *
13 * your option) any later version. *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
18 * See the GNU General Public License for more details. *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, you can get it from: *
22 * http://www.gnu.org/copyleft/gpl.html *
23 **********************************************************************/
26 using System.Runtime.InteropServices;
28 namespace VideoLAN.LibVLC
31 * Abstract safe handle class for non-NULL pointers
32 * (Microsoft.* namespace has a similar class,
33 * but lets stick to System.*).
35 public abstract class NonNullHandle : SafeHandle
37 protected NonNullHandle ()
38 : base (IntPtr.Zero, true)
42 public override bool IsInvalid
46 return handle == IntPtr.Zero;
52 * Generic class for managed wrapper around a native safe handle.
54 public class BaseObject<HandleT> : IDisposable where HandleT : SafeHandle
56 protected NativeException ex;
57 protected HandleT self;
59 internal BaseObject (HandleT self)
62 ex = new NativeException ();
65 public void Dispose ()