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