1 module webkit2.MimeInfo;
2 
3 private import glib.Str;
4 private import gobject.ObjectG;
5 private import webkit2.c.functions;
6 public  import webkit2.c.types;
7 
8 
9 /** */
10 public class MimeInfo
11 {
12 	/** the main Gtk struct */
13 	protected WebKitMimeInfo* webKitMimeInfo;
14 	protected bool ownedRef;
15 
16 	/** Get the main Gtk struct */
17 	public WebKitMimeInfo* getMimeInfoStruct(bool transferOwnership = false)
18 	{
19 		if (transferOwnership)
20 			ownedRef = false;
21 		return webKitMimeInfo;
22 	}
23 
24 	/** the main Gtk struct as a void* */
25 	protected void* getStruct()
26 	{
27 		return cast(void*)webKitMimeInfo;
28 	}
29 
30 	/**
31 	 * Sets our main struct and passes it to the parent class.
32 	 */
33 	public this (WebKitMimeInfo* webKitMimeInfo, bool ownedRef = false)
34 	{
35 		this.webKitMimeInfo = webKitMimeInfo;
36 		this.ownedRef = ownedRef;
37 	}
38 
39 	~this ()
40 	{
41 		if ( ownedRef )
42 			webkit_mime_info_unref(webKitMimeInfo);
43 	}
44 
45 
46 	/** */
47 	public static GType getType()
48 	{
49 		return webkit_mime_info_get_type();
50 	}
51 
52 	/**
53 	 * Returns: the description of the MIME type of @info
54 	 */
55 	public string getDescription()
56 	{
57 		return Str.toString(webkit_mime_info_get_description(webKitMimeInfo));
58 	}
59 
60 	/**
61 	 * Get the list of file extensions associated to the
62 	 * MIME type of @info
63 	 *
64 	 * Returns: a
65 	 *     %NULL-terminated array of strings
66 	 */
67 	public string[] getExtensions()
68 	{
69 		return Str.toStringArray(webkit_mime_info_get_extensions(webKitMimeInfo));
70 	}
71 
72 	/**
73 	 * Returns: the MIME type of @info
74 	 */
75 	public string getMimeType()
76 	{
77 		return Str.toString(webkit_mime_info_get_mime_type(webKitMimeInfo));
78 	}
79 
80 	alias doref = ref_;
81 	/**
82 	 * Atomically increments the reference count of @info by one. This
83 	 * function is MT-safe and may be called from any thread.
84 	 *
85 	 * Returns: The passed in #WebKitMimeInfo
86 	 */
87 	public MimeInfo ref_()
88 	{
89 		auto __p = webkit_mime_info_ref(webKitMimeInfo);
90 
91 		if(__p is null)
92 		{
93 			return null;
94 		}
95 
96 		return ObjectG.getDObject!(MimeInfo)(cast(WebKitMimeInfo*) __p, true);
97 	}
98 
99 	/**
100 	 * Atomically decrements the reference count of @info by one. If the
101 	 * reference count drops to 0, all memory allocated by the #WebKitMimeInfo is
102 	 * released. This function is MT-safe and may be called from any
103 	 * thread.
104 	 */
105 	public void unref()
106 	{
107 		webkit_mime_info_unref(webKitMimeInfo);
108 	}
109 }