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