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 gsv.RegionIter;
26 
27 private import gobject.ObjectG;
28 private import gsv.c.functions;
29 public  import gsv.c.types;
30 public  import gsvc.gsvtypes;
31 private import gtk.TextIter;
32 
33 
34 /**
35  * #GtkSourceRegionIter is an opaque datatype; ignore all its fields.
36  * Initialize the iter with gtk_source_region_get_start_region_iter().
37  *
38  * Since: 3.22
39  */
40 public class RegionIter
41 {
42 	/** the main Gtk struct */
43 	protected GtkSourceRegionIter* gtkSourceRegionIter;
44 	protected bool ownedRef;
45 
46 	/** Get the main Gtk struct */
47 	public GtkSourceRegionIter* getRegionIterStruct(bool transferOwnership = false)
48 	{
49 		if (transferOwnership)
50 			ownedRef = false;
51 		return gtkSourceRegionIter;
52 	}
53 
54 	/** the main Gtk struct as a void* */
55 	protected void* getStruct()
56 	{
57 		return cast(void*)gtkSourceRegionIter;
58 	}
59 
60 	/**
61 	 * Sets our main struct and passes it to the parent class.
62 	 */
63 	public this (GtkSourceRegionIter* gtkSourceRegionIter, bool ownedRef = false)
64 	{
65 		this.gtkSourceRegionIter = gtkSourceRegionIter;
66 		this.ownedRef = ownedRef;
67 	}
68 
69 
70 	/**
71 	 * Gets the subregion at this iterator.
72 	 *
73 	 * Params:
74 	 *     start = iterator to initialize with the subregion start, or %NULL.
75 	 *     end = iterator to initialize with the subregion end, or %NULL.
76 	 *
77 	 * Returns: %TRUE if @start and @end have been set successfully (if non-%NULL),
78 	 *     or %FALSE if @iter is the end iterator or if the region is empty.
79 	 *
80 	 * Since: 3.22
81 	 */
82 	public bool getSubregion(out TextIter start, out TextIter end)
83 	{
84 		GtkTextIter* outstart = gMalloc!GtkTextIter();
85 		GtkTextIter* outend = gMalloc!GtkTextIter();
86 
87 		auto p = gtk_source_region_iter_get_subregion(gtkSourceRegionIter, outstart, outend) != 0;
88 
89 		start = ObjectG.getDObject!(TextIter)(outstart, true);
90 		end = ObjectG.getDObject!(TextIter)(outend, true);
91 
92 		return p;
93 	}
94 
95 	/**
96 	 * Returns: whether @iter is the end iterator.
97 	 *
98 	 * Since: 3.22
99 	 */
100 	public bool isEnd()
101 	{
102 		return gtk_source_region_iter_is_end(gtkSourceRegionIter) != 0;
103 	}
104 
105 	/**
106 	 * Moves @iter to the next subregion.
107 	 *
108 	 * Returns: %TRUE if @iter moved and is dereferenceable, or %FALSE if @iter has
109 	 *     been set to the end iterator.
110 	 *
111 	 * Since: 3.22
112 	 */
113 	public bool next()
114 	{
115 		return gtk_source_region_iter_next(gtkSourceRegionIter) != 0;
116 	}
117 }