1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = GTlsPassword.html
27  * outPack = gio
28  * outFile = TlsPassword
29  * strct   = GTlsPassword
30  * realStrct=
31  * ctorStrct=
32  * clss    = TlsPassword
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_tls_password_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * structWrap:
48  * module aliases:
49  * local aliases:
50  * overrides:
51  */
52 
53 module gio.TlsPassword;
54 
55 public  import gtkc.giotypes;
56 
57 private import gtkc.gio;
58 private import glib.ConstructionException;
59 private import gobject.ObjectG;
60 
61 private import glib.Str;
62 
63 
64 private import gobject.ObjectG;
65 
66 /**
67  * Holds a password used in TLS.
68  */
69 public class TlsPassword : ObjectG
70 {
71 	
72 	/** the main Gtk struct */
73 	protected GTlsPassword* gTlsPassword;
74 	
75 	
76 	/** Get the main Gtk struct */
77 	public GTlsPassword* getTlsPasswordStruct()
78 	{
79 		return gTlsPassword;
80 	}
81 	
82 	
83 	/** the main Gtk struct as a void* */
84 	protected override void* getStruct()
85 	{
86 		return cast(void*)gTlsPassword;
87 	}
88 	
89 	/**
90 	 * Sets our main struct and passes it to the parent class
91 	 */
92 	public this (GTlsPassword* gTlsPassword)
93 	{
94 		super(cast(GObject*)gTlsPassword);
95 		this.gTlsPassword = gTlsPassword;
96 	}
97 	
98 	protected override void setStruct(GObject* obj)
99 	{
100 		super.setStruct(obj);
101 		gTlsPassword = cast(GTlsPassword*)obj;
102 	}
103 	
104 	/**
105 	 */
106 	
107 	/**
108 	 * Create a new GTlsPassword object.
109 	 * Params:
110 	 * flags = the password flags
111 	 * description = description of what the password is for
112 	 * Throws: ConstructionException GTK+ fails to create the object.
113 	 */
114 	public this (GTlsPasswordFlags flags, string description)
115 	{
116 		// GTlsPassword * g_tls_password_new (GTlsPasswordFlags flags,  const gchar *description);
117 		auto p = g_tls_password_new(flags, Str.toStringz(description));
118 		if(p is null)
119 		{
120 			throw new ConstructionException("null returned by g_tls_password_new(flags, Str.toStringz(description))");
121 		}
122 		this(cast(GTlsPassword*) p);
123 	}
124 	
125 	/**
126 	 * Get the password value. If length is not NULL then it will be
127 	 * filled in with the length of the password value. (Note that the
128 	 * password value is not nul-terminated, so you can only pass NULL
129 	 * for length in contexts where you know the password will have a
130 	 * certain fixed length.)
131 	 * Since 2.30
132 	 * Returns: The password value (owned by the password object).
133 	 */
134 	public char[] getValue()
135 	{
136 		// const guchar * g_tls_password_get_value (GTlsPassword *password,  gsize *length);
137 		gsize length;
138 		auto p = g_tls_password_get_value(gTlsPassword, &length);
139 		
140 		if(p is null)
141 		{
142 			return null;
143 		}
144 		
145 		return p[0 .. length];
146 	}
147 	
148 	/**
149 	 * Set the value for this password. The value will be copied by the password
150 	 * object.
151 	 * Specify the length, for a non-nul-terminated password. Pass -1 as
152 	 * length if using a nul-terminated password, and length will be
153 	 * calculated automatically. (Note that the terminating nul is not
154 	 * considered part of the password in this case.)
155 	 * Since 2.30
156 	 * Params:
157 	 * value = the new password value
158 	 */
159 	public void setValue(char[] value)
160 	{
161 		// void g_tls_password_set_value (GTlsPassword *password,  const guchar *value,  gssize length);
162 		g_tls_password_set_value(gTlsPassword, value.ptr, cast(int) value.length);
163 	}
164 	
165 	/**
166 	 * Provide the value for this password.
167 	 * The value will be owned by the password object, and later freed using
168 	 * the destroy function callback.
169 	 * Specify the length, for a non-nul-terminated password. Pass -1 as
170 	 * length if using a nul-terminated password, and length will be
171 	 * calculated automatically. (Note that the terminating nul is not
172 	 * considered part of the password in this case.)
173 	 * Virtual: set_value
174 	 * Since 2.30
175 	 * Params:
176 	 * value = the value for the password
177 	 * destroy = a function to use to free the password. [allow-none]
178 	 */
179 	public void setValueFull(char[] value, GDestroyNotify destroy)
180 	{
181 		// void g_tls_password_set_value_full (GTlsPassword *password,  guchar *value,  gssize length,  GDestroyNotify destroy);
182 		g_tls_password_set_value_full(gTlsPassword, value.ptr, cast(int) value.length, destroy);
183 	}
184 	
185 	/**
186 	 * Get a description string about what the password will be used for.
187 	 * Since 2.30
188 	 * Returns: The description of the password.
189 	 */
190 	public string getDescription()
191 	{
192 		// const gchar * g_tls_password_get_description (GTlsPassword *password);
193 		return Str.toString(g_tls_password_get_description(gTlsPassword));
194 	}
195 	
196 	/**
197 	 * Set a description string about what the password will be used for.
198 	 * Since 2.30
199 	 * Params:
200 	 * description = The description of the password
201 	 */
202 	public void setDescription(string description)
203 	{
204 		// void g_tls_password_set_description (GTlsPassword *password,  const gchar *description);
205 		g_tls_password_set_description(gTlsPassword, Str.toStringz(description));
206 	}
207 	
208 	/**
209 	 * Get flags about the password.
210 	 * Since 2.30
211 	 * Returns: The flags about the password.
212 	 */
213 	public GTlsPasswordFlags getFlags()
214 	{
215 		// GTlsPasswordFlags g_tls_password_get_flags (GTlsPassword *password);
216 		return g_tls_password_get_flags(gTlsPassword);
217 	}
218 	
219 	/**
220 	 * Set flags about the password.
221 	 * Since 2.30
222 	 * Params:
223 	 * flags = The flags about the password
224 	 */
225 	public void setFlags(GTlsPasswordFlags flags)
226 	{
227 		// void g_tls_password_set_flags (GTlsPassword *password,  GTlsPasswordFlags flags);
228 		g_tls_password_set_flags(gTlsPassword, flags);
229 	}
230 	
231 	/**
232 	 * Get a user readable translated warning. Usually this warning is a
233 	 * representation of the password flags returned from
234 	 * g_tls_password_get_flags().
235 	 * Since 2.30
236 	 * Returns: The warning.
237 	 */
238 	public string getWarning()
239 	{
240 		// const gchar * g_tls_password_get_warning (GTlsPassword *password);
241 		return Str.toString(g_tls_password_get_warning(gTlsPassword));
242 	}
243 	
244 	/**
245 	 * Set a user readable translated warning. Usually this warning is a
246 	 * representation of the password flags returned from
247 	 * g_tls_password_get_flags().
248 	 * Since 2.30
249 	 * Params:
250 	 * warning = The user readable warning
251 	 */
252 	public void setWarning(string warning)
253 	{
254 		// void g_tls_password_set_warning (GTlsPassword *password,  const gchar *warning);
255 		g_tls_password_set_warning(gTlsPassword, Str.toStringz(warning));
256 	}
257 }