1 module soup.HSTSEnforcerDB;
2 
3 private import glib.ConstructionException;
4 private import glib.Str;
5 private import gobject.ObjectG;
6 private import soup.HSTSEnforcer;
7 private import soup.c.functions;
8 public  import soup.c.types;
9 
10 
11 /**
12  * #SoupHSTSEnforcerDB is a #SoupHSTSEnforcer that uses a SQLite
13  * database as a backend for persistency.
14  */
15 public class HSTSEnforcerDB : HSTSEnforcer
16 {
17 	/** the main Gtk struct */
18 	protected SoupHSTSEnforcerDB* soupHSTSEnforcerDB;
19 
20 	/** Get the main Gtk struct */
21 	public SoupHSTSEnforcerDB* getHSTSEnforcerDBStruct(bool transferOwnership = false)
22 	{
23 		if (transferOwnership)
24 			ownedRef = false;
25 		return soupHSTSEnforcerDB;
26 	}
27 
28 	/** the main Gtk struct as a void* */
29 	protected override void* getStruct()
30 	{
31 		return cast(void*)soupHSTSEnforcerDB;
32 	}
33 
34 	/**
35 	 * Sets our main struct and passes it to the parent class.
36 	 */
37 	public this (SoupHSTSEnforcerDB* soupHSTSEnforcerDB, bool ownedRef = false)
38 	{
39 		this.soupHSTSEnforcerDB = soupHSTSEnforcerDB;
40 		super(cast(SoupHSTSEnforcer*)soupHSTSEnforcerDB, ownedRef);
41 	}
42 
43 
44 	/** */
45 	public static GType getType()
46 	{
47 		return soup_hsts_enforcer_db_get_type();
48 	}
49 
50 	/**
51 	 * Creates a #SoupHSTSEnforcerDB.
52 	 *
53 	 * @filename will be read in during the initialization of a
54 	 * #SoupHSTSEnforcerDB, in order to create an initial set of HSTS
55 	 * policies. If the file doesn't exist, a new database will be created
56 	 * and initialized. Changes to the policies during the lifetime of a
57 	 * #SoupHSTSEnforcerDB will be written to @filename when
58 	 * #SoupHSTSEnforcer::changed is emitted.
59 	 *
60 	 * Params:
61 	 *     filename = the filename of the database to read/write from.
62 	 *
63 	 * Returns: the new #SoupHSTSEnforcer
64 	 *
65 	 * Since: 2.68
66 	 *
67 	 * Throws: ConstructionException GTK+ fails to create the object.
68 	 */
69 	public this(string filename)
70 	{
71 		auto __p = soup_hsts_enforcer_db_new(Str.toStringz(filename));
72 
73 		if(__p is null)
74 		{
75 			throw new ConstructionException("null returned by new");
76 		}
77 
78 		this(cast(SoupHSTSEnforcerDB*) __p, true);
79 	}
80 }