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