// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.

namespace Poppler {

	using System;
	using System.Collections;
	using System.Runtime.InteropServices;

#region Autogenerated code
	public class Attachment : GLib.Object {

		[Obsolete]
		protected Attachment(GLib.GType gtype) : base(gtype) {}
		public Attachment(IntPtr raw) : base(raw) {}

		protected Attachment() : base(IntPtr.Zero)
		{
			CreateNativeObject (new string [0], new GLib.Value [0]);
		}

		[DllImport("poppler-glib")]
		static extern unsafe bool poppler_attachment_save_to_callback(IntPtr raw, PopplerSharp.AttachmentSaveFuncNative save_func, IntPtr user_data, out IntPtr error);

		public unsafe bool SaveToCallback(Poppler.AttachmentSaveFunc save_func) {
			PopplerSharp.AttachmentSaveFuncWrapper save_func_wrapper = new PopplerSharp.AttachmentSaveFuncWrapper (save_func);
			IntPtr error = IntPtr.Zero;
			bool raw_ret = poppler_attachment_save_to_callback(Handle, save_func_wrapper.NativeDelegate, IntPtr.Zero, out error);
			bool ret = raw_ret;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[DllImport("poppler-glib")]
		static extern IntPtr poppler_attachment_get_type();

		public static new GLib.GType GType { 
			get {
				IntPtr raw_ret = poppler_attachment_get_type();
				GLib.GType ret = new GLib.GType(raw_ret);
				return ret;
			}
		}

		[DllImport("poppler-glib")]
		static extern unsafe bool poppler_attachment_save(IntPtr raw, IntPtr filename, out IntPtr error);

		public unsafe bool Save(string filename) {
			IntPtr native_filename = GLib.Marshaller.StringToPtrGStrdup (filename);
			IntPtr error = IntPtr.Zero;
			bool raw_ret = poppler_attachment_save(Handle, native_filename, out error);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_filename);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

#endregion
	}
}
