source: appstream-generator/build/girepo/gio/TlsPassword.d @ 4841

Last change on this file since 4841 was 4841, checked in by Juanma, 2 years ago

Initial release

File size: 5.8 KB
Line 
1/*
2 * Licensed under the GNU Lesser General Public License Version 3
3 *
4 * This library is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the license, or
7 * (at your option) any later version.
8 *
9 * This software is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18// generated automatically - do not change
19
20
21module gio.TlsPassword;
22
23private import gi.gio;
24public  import gi.giotypes;
25private import glib.ConstructionException;
26private import glib.Str;
27private import gobject.ObjectG;
28
29
30/**
31 * Holds a password used in TLS.
32 *
33 * Since: 2.30
34 */
35public class TlsPassword : ObjectG
36{
37        /** the main Gtk struct */
38        protected GTlsPassword* gTlsPassword;
39
40        /** Get the main Gtk struct */
41        public GTlsPassword* getTlsPasswordStruct()
42        {
43                return gTlsPassword;
44        }
45
46        /** the main Gtk struct as a void* */
47        protected override void* getStruct()
48        {
49                return cast(void*)gTlsPassword;
50        }
51
52        protected override void setStruct(GObject* obj)
53        {
54                gTlsPassword = cast(GTlsPassword*)obj;
55                super.setStruct(obj);
56        }
57
58        /**
59         * Sets our main struct and passes it to the parent class.
60         */
61        public this (GTlsPassword* gTlsPassword, bool ownedRef = false)
62        {
63                this.gTlsPassword = gTlsPassword;
64                super(cast(GObject*)gTlsPassword, ownedRef);
65        }
66
67
68        /** */
69        public static GType getType()
70        {
71                return g_tls_password_get_type();
72        }
73
74        /**
75         * Create a new #GTlsPassword object.
76         *
77         * Params:
78         *     flags = the password flags
79         *     description = description of what the password is for
80         *
81         * Returns: The newly allocated password object
82         *
83         * Throws: ConstructionException GTK+ fails to create the object.
84         */
85        public this(GTlsPasswordFlags flags, string description)
86        {
87                auto p = g_tls_password_new(flags, Str.toStringz(description));
88               
89                if(p is null)
90                {
91                        throw new ConstructionException("null returned by new");
92                }
93               
94                this(cast(GTlsPassword*) p, true);
95        }
96
97        /**
98         * Get a description string about what the password will be used for.
99         *
100         * Returns: The description of the password.
101         *
102         * Since: 2.30
103         */
104        public string getDescription()
105        {
106                return Str.toString(g_tls_password_get_description(gTlsPassword));
107        }
108
109        /**
110         * Get flags about the password.
111         *
112         * Returns: The flags about the password.
113         *
114         * Since: 2.30
115         */
116        public GTlsPasswordFlags getFlags()
117        {
118                return g_tls_password_get_flags(gTlsPassword);
119        }
120
121        /**
122         * Get the password value. If @length is not %NULL then it will be
123         * filled in with the length of the password value. (Note that the
124         * password value is not nul-terminated, so you can only pass %NULL
125         * for @length in contexts where you know the password will have a
126         * certain fixed length.)
127         *
128         * Returns: The password value (owned by the password object).
129         *
130         * Since: 2.30
131         */
132        public char[] getValue()
133        {
134                size_t length;
135               
136                auto p = g_tls_password_get_value(gTlsPassword, &length);
137               
138                return p[0 .. length];
139        }
140
141        /**
142         * Get a user readable translated warning. Usually this warning is a
143         * representation of the password flags returned from
144         * g_tls_password_get_flags().
145         *
146         * Returns: The warning.
147         *
148         * Since: 2.30
149         */
150        public string getWarning()
151        {
152                return Str.toString(g_tls_password_get_warning(gTlsPassword));
153        }
154
155        /**
156         * Set a description string about what the password will be used for.
157         *
158         * Params:
159         *     description = The description of the password
160         *
161         * Since: 2.30
162         */
163        public void setDescription(string description)
164        {
165                g_tls_password_set_description(gTlsPassword, Str.toStringz(description));
166        }
167
168        /**
169         * Set flags about the password.
170         *
171         * Params:
172         *     flags = The flags about the password
173         *
174         * Since: 2.30
175         */
176        public void setFlags(GTlsPasswordFlags flags)
177        {
178                g_tls_password_set_flags(gTlsPassword, flags);
179        }
180
181        /**
182         * Set the value for this password. The @value will be copied by the password
183         * object.
184         *
185         * Specify the @length, for a non-nul-terminated password. Pass -1 as
186         * @length if using a nul-terminated password, and @length will be
187         * calculated automatically. (Note that the terminating nul is not
188         * considered part of the password in this case.)
189         *
190         * Params:
191         *     value = the new password value
192         *     length = the length of the password, or -1
193         *
194         * Since: 2.30
195         */
196        public void setValue(char[] value)
197        {
198                g_tls_password_set_value(gTlsPassword, value.ptr, cast(ptrdiff_t)value.length);
199        }
200
201        /**
202         * Provide the value for this password.
203         *
204         * The @value will be owned by the password object, and later freed using
205         * the @destroy function callback.
206         *
207         * Specify the @length, for a non-nul-terminated password. Pass -1 as
208         * @length if using a nul-terminated password, and @length will be
209         * calculated automatically. (Note that the terminating nul is not
210         * considered part of the password in this case.)
211         *
212         * Params:
213         *     value = the value for the password
214         *     length = the length of the password, or -1
215         *     destroy = a function to use to free the password.
216         *
217         * Since: 2.30
218         */
219        public void setValueFull(char[] value, GDestroyNotify destroy)
220        {
221                g_tls_password_set_value_full(gTlsPassword, value.ptr, cast(ptrdiff_t)value.length, destroy);
222        }
223
224        /**
225         * Set a user readable translated warning. Usually this warning is a
226         * representation of the password flags returned from
227         * g_tls_password_get_flags().
228         *
229         * Params:
230         *     warning = The user readable warning
231         *
232         * Since: 2.30
233         */
234        public void setWarning(string warning)
235        {
236                g_tls_password_set_warning(gTlsPassword, Str.toStringz(warning));
237        }
238}
Note: See TracBrowser for help on using the repository browser.