1 module webkit2.WebsiteData;
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  * WebKitWebsiteData represents data stored in the client by a particular website.
11  * A website is normally a set of URLs grouped by domain name. You can get the website name,
12  * which is usually the domain, with webkit_website_data_get_name().
13  * Documents loaded from the file system, like file:// URIs, are all grouped in the same WebKitWebsiteData
14  * with the name "Local files".
15  * 
16  * A website can store different types of data in the client side. #WebKitWebsiteDataTypes is an enum containing
17  * all the possible data types; use webkit_website_data_get_types() to get the bitmask of data types.
18  * It's also possible to know the size of the data stored for some of the #WebKitWebsiteDataTypes by using
19  * webkit_website_data_get_size().
20  * 
21  * A list of WebKitWebsiteData can be retrieved with webkit_website_data_manager_fetch(). See #WebKitWebsiteDataManager
22  * for more information.
23  *
24  * Since: 2.16
25  */
26 public class WebsiteData
27 {
28 	/** the main Gtk struct */
29 	protected WebKitWebsiteData* webKitWebsiteData;
30 	protected bool ownedRef;
31 
32 	/** Get the main Gtk struct */
33 	public WebKitWebsiteData* getWebsiteDataStruct(bool transferOwnership = false)
34 	{
35 		if (transferOwnership)
36 			ownedRef = false;
37 		return webKitWebsiteData;
38 	}
39 
40 	/** the main Gtk struct as a void* */
41 	protected void* getStruct()
42 	{
43 		return cast(void*)webKitWebsiteData;
44 	}
45 
46 	/**
47 	 * Sets our main struct and passes it to the parent class.
48 	 */
49 	public this (WebKitWebsiteData* webKitWebsiteData, bool ownedRef = false)
50 	{
51 		this.webKitWebsiteData = webKitWebsiteData;
52 		this.ownedRef = ownedRef;
53 	}
54 
55 	~this ()
56 	{
57 		if ( ownedRef )
58 			webkit_website_data_unref(webKitWebsiteData);
59 	}
60 
61 
62 	/** */
63 	public static GType getType()
64 	{
65 		return webkit_website_data_get_type();
66 	}
67 
68 	/**
69 	 * Gets the name of #WebKitWebsiteData. This is the website name, normally represented by
70 	 * a domain or host name. All local documents are grouped in the same #WebKitWebsiteData using
71 	 * the name "Local files".
72 	 *
73 	 * Returns: the website name of @website_data.
74 	 *
75 	 * Since: 2.16
76 	 */
77 	public string getName()
78 	{
79 		return Str.toString(webkit_website_data_get_name(webKitWebsiteData));
80 	}
81 
82 	/**
83 	 * Gets the size of the data of types @types in a #WebKitWebsiteData.
84 	 * Note that currently the data size is only known for %WEBKIT_WEBSITE_DATA_DISK_CACHE data type
85 	 * so for all other types 0 will be returned.
86 	 *
87 	 * Params:
88 	 *     types = a bitmask  of #WebKitWebsiteDataTypes
89 	 *
90 	 * Returns: the size of @website_data for the given @types.
91 	 *
92 	 * Since: 2.16
93 	 */
94 	public ulong getSize(WebKitWebsiteDataTypes types)
95 	{
96 		return webkit_website_data_get_size(webKitWebsiteData, types);
97 	}
98 
99 	/**
100 	 * Gets the types of data stored in the client for a #WebKitWebsiteData. These are the
101 	 * types actually present, not the types queried with webkit_website_data_manager_fetch().
102 	 *
103 	 * Returns: a bitmask of #WebKitWebsiteDataTypes in @website_data
104 	 *
105 	 * Since: 2.16
106 	 */
107 	public WebKitWebsiteDataTypes getTypes()
108 	{
109 		return webkit_website_data_get_types(webKitWebsiteData);
110 	}
111 
112 	alias doref = ref_;
113 	/**
114 	 * Atomically increments the reference count of @website_data by one.
115 	 * This function is MT-safe and may be called from any thread.
116 	 *
117 	 * Returns: The passed #WebKitWebsiteData
118 	 *
119 	 * Since: 2.16
120 	 */
121 	public WebsiteData ref_()
122 	{
123 		auto __p = webkit_website_data_ref(webKitWebsiteData);
124 
125 		if(__p is null)
126 		{
127 			return null;
128 		}
129 
130 		return ObjectG.getDObject!(WebsiteData)(cast(WebKitWebsiteData*) __p, true);
131 	}
132 
133 	/**
134 	 * Atomically decrements the reference count of @website_data by one.
135 	 * If the reference count drops to 0, all memory allocated by
136 	 * #WebKitWebsiteData is released. This function is MT-safe and may be
137 	 * called from any thread.
138 	 *
139 	 * Since: 2.16
140 	 */
141 	public void unref()
142 	{
143 		webkit_website_data_unref(webKitWebsiteData);
144 	}
145 }