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

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

Initial release

File size: 4.3 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.MenuAttributeIter;
22
23private import gi.gio;
24public  import gi.giotypes;
25private import glib.Str;
26private import glib.Variant;
27private import gobject.ObjectG;
28
29
30/**
31 * #GMenuAttributeIter is an opaque structure type.  You must access it
32 * using the functions below.
33 *
34 * Since: 2.32
35 */
36public class MenuAttributeIter : ObjectG
37{
38        /** the main Gtk struct */
39        protected GMenuAttributeIter* gMenuAttributeIter;
40
41        /** Get the main Gtk struct */
42        public GMenuAttributeIter* getMenuAttributeIterStruct()
43        {
44                return gMenuAttributeIter;
45        }
46
47        /** the main Gtk struct as a void* */
48        protected override void* getStruct()
49        {
50                return cast(void*)gMenuAttributeIter;
51        }
52
53        protected override void setStruct(GObject* obj)
54        {
55                gMenuAttributeIter = cast(GMenuAttributeIter*)obj;
56                super.setStruct(obj);
57        }
58
59        /**
60         * Sets our main struct and passes it to the parent class.
61         */
62        public this (GMenuAttributeIter* gMenuAttributeIter, bool ownedRef = false)
63        {
64                this.gMenuAttributeIter = gMenuAttributeIter;
65                super(cast(GObject*)gMenuAttributeIter, ownedRef);
66        }
67
68
69        /** */
70        public static GType getType()
71        {
72                return g_menu_attribute_iter_get_type();
73        }
74
75        /**
76         * Gets the name of the attribute at the current iterator position, as
77         * a string.
78         *
79         * The iterator is not advanced.
80         *
81         * Returns: the name of the attribute
82         *
83         * Since: 2.32
84         */
85        public string getName()
86        {
87                return Str.toString(g_menu_attribute_iter_get_name(gMenuAttributeIter));
88        }
89
90        /**
91         * This function combines g_menu_attribute_iter_next() with
92         * g_menu_attribute_iter_get_name() and g_menu_attribute_iter_get_value().
93         *
94         * First the iterator is advanced to the next (possibly first) attribute.
95         * If that fails, then %FALSE is returned and there are no other
96         * effects.
97         *
98         * If successful, @name and @value are set to the name and value of the
99         * attribute that has just been advanced to.  At this point,
100         * g_menu_attribute_iter_get_name() and g_menu_attribute_iter_get_value() will
101         * return the same values again.
102         *
103         * The value returned in @name remains valid for as long as the iterator
104         * remains at the current position.  The value returned in @value must
105         * be unreffed using g_variant_unref() when it is no longer in use.
106         *
107         * Params:
108         *     outName = the type of the attribute
109         *     value = the attribute value
110         *
111         * Returns: %TRUE on success, or %FALSE if there is no additional
112         *     attribute
113         *
114         * Since: 2.32
115         */
116        public bool getNext(out string outName, out Variant value)
117        {
118                char* outoutName = null;
119                GVariant* outvalue = null;
120               
121                auto p = g_menu_attribute_iter_get_next(gMenuAttributeIter, &outoutName, &outvalue) != 0;
122               
123                outName = Str.toString(outoutName);
124                value = new Variant(outvalue);
125               
126                return p;
127        }
128
129        /**
130         * Gets the value of the attribute at the current iterator position.
131         *
132         * The iterator is not advanced.
133         *
134         * Returns: the value of the current attribute
135         *
136         * Since: 2.32
137         */
138        public Variant getValue()
139        {
140                auto p = g_menu_attribute_iter_get_value(gMenuAttributeIter);
141               
142                if(p is null)
143                {
144                        return null;
145                }
146               
147                return new Variant(cast(GVariant*) p, true);
148        }
149
150        /**
151         * Attempts to advance the iterator to the next (possibly first)
152         * attribute.
153         *
154         * %TRUE is returned on success, or %FALSE if there are no more
155         * attributes.
156         *
157         * You must call this function when you first acquire the iterator
158         * to advance it to the first attribute (and determine if the first
159         * attribute exists at all).
160         *
161         * Returns: %TRUE on success, or %FALSE when there are no more attributes
162         *
163         * Since: 2.32
164         */
165        public bool next()
166        {
167                return g_menu_attribute_iter_next(gMenuAttributeIter) != 0;
168        }
169}
Note: See TracBrowser for help on using the repository browser.