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