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 vte.Regex;
26 
27 private import glib.ConstructionException;
28 private import glib.ErrorG;
29 private import glib.GException;
30 private import glib.Str;
31 private import gobject.ObjectG;
32 private import vtec.vte;
33 public  import vtec.vtetypes;
34 
35 
36 /** */
37 public class Regex
38 {
39 	/** the main Gtk struct */
40 	protected VteRegex* vteRegex;
41 	protected bool ownedRef;
42 
43 	/** Get the main Gtk struct */
44 	public VteRegex* getRegexStruct()
45 	{
46 		return vteRegex;
47 	}
48 
49 	/** the main Gtk struct as a void* */
50 	protected void* getStruct()
51 	{
52 		return cast(void*)vteRegex;
53 	}
54 
55 	/**
56 	 * Sets our main struct and passes it to the parent class.
57 	 */
58 	public this (VteRegex* vteRegex, bool ownedRef = false)
59 	{
60 		this.vteRegex = vteRegex;
61 		this.ownedRef = ownedRef;
62 	}
63 
64 	/** */
65 	public static Regex newMatch(string pattern, ptrdiff_t patternLength, uint flags)
66 	{
67 		GError* err = null;
68 		
69 		auto p = vte_regex_new_for_match(Str.toStringz(pattern), patternLength, flags, &err);
70 		
71 		if (err !is null)
72 		{
73 			throw new GException( new ErrorG(err) );
74 		}
75 		
76 		if(p is null)
77 		{
78 			throw new ConstructionException("null returned by new_for_match");
79 		}
80 		
81 		return new Regex(cast(VteRegex*) p);
82 	}
83 	
84 	/** */
85 	public static Regex newSearch(string pattern, ptrdiff_t patternLength, uint flags)
86 	{
87 		GError* err = null;
88 		
89 		auto p = vte_regex_new_for_search(Str.toStringz(pattern), patternLength, flags, &err);
90 		
91 		if (err !is null)
92 		{
93 			throw new GException( new ErrorG(err) );
94 		}
95 		
96 		if(p is null)
97 		{
98 			throw new ConstructionException("null returned by new_for_search");
99 		}
100 		
101 		return new Regex(cast(VteRegex*) p);
102 	}
103 
104 	/**
105 	 */
106 
107 	/** */
108 	public static GType getType()
109 	{
110 		return vte_regex_get_type();
111 	}
112 
113 	/** */
114 	public bool jit(uint flags)
115 	{
116 		GError* err = null;
117 		
118 		auto p = vte_regex_jit(vteRegex, flags, &err) != 0;
119 		
120 		if (err !is null)
121 		{
122 			throw new GException( new ErrorG(err) );
123 		}
124 		
125 		return p;
126 	}
127 
128 	/** */
129 	public Regex doref()
130 	{
131 		auto p = vte_regex_ref(vteRegex);
132 		
133 		if(p is null)
134 		{
135 			return null;
136 		}
137 		
138 		return ObjectG.getDObject!(Regex)(cast(VteRegex*) p, true);
139 	}
140 
141 	/** */
142 	public Regex unref()
143 	{
144 		auto p = vte_regex_unref(vteRegex);
145 		
146 		if(p is null)
147 		{
148 			return null;
149 		}
150 		
151 		return ObjectG.getDObject!(Regex)(cast(VteRegex*) p, true);
152 	}
153 }