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