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