1 module webkit2webextension.DOMCharacterData; 2 3 private import glib.ErrorG; 4 private import glib.GException; 5 private import glib.Str; 6 private import webkit2webextension.DOMNode; 7 private import webkit2webextension.c.functions; 8 public import webkit2webextension.c.types; 9 10 11 /** */ 12 public class DOMCharacterData : DOMNode 13 { 14 /** the main Gtk struct */ 15 protected WebKitDOMCharacterData* webKitDOMCharacterData; 16 17 /** Get the main Gtk struct */ 18 public WebKitDOMCharacterData* getDOMCharacterDataStruct(bool transferOwnership = false) 19 { 20 if (transferOwnership) 21 ownedRef = false; 22 return webKitDOMCharacterData; 23 } 24 25 /** the main Gtk struct as a void* */ 26 protected override void* getStruct() 27 { 28 return cast(void*)webKitDOMCharacterData; 29 } 30 31 /** 32 * Sets our main struct and passes it to the parent class. 33 */ 34 public this (WebKitDOMCharacterData* webKitDOMCharacterData, bool ownedRef = false) 35 { 36 this.webKitDOMCharacterData = webKitDOMCharacterData; 37 super(cast(WebKitDOMNode*)webKitDOMCharacterData, ownedRef); 38 } 39 40 41 /** */ 42 public static GType getType() 43 { 44 return webkit_dom_character_data_get_type(); 45 } 46 47 /** 48 * 49 * 50 * Deprecated: Use JavaScriptCore API instead 51 * 52 * Params: 53 * data = A #gchar 54 * 55 * Throws: GException on failure. 56 */ 57 public void appendData(string data) 58 { 59 GError* err = null; 60 61 webkit_dom_character_data_append_data(webKitDOMCharacterData, Str.toStringz(data), &err); 62 63 if (err !is null) 64 { 65 throw new GException( new ErrorG(err) ); 66 } 67 } 68 69 /** 70 * 71 * 72 * Deprecated: Use JavaScriptCore API instead 73 * 74 * Params: 75 * offset = A #gulong 76 * length = A #gulong 77 * 78 * Throws: GException on failure. 79 */ 80 public void deleteData(gulong offset, gulong length) 81 { 82 GError* err = null; 83 84 webkit_dom_character_data_delete_data(webKitDOMCharacterData, offset, length, &err); 85 86 if (err !is null) 87 { 88 throw new GException( new ErrorG(err) ); 89 } 90 } 91 92 /** 93 * 94 * 95 * Deprecated: Use JavaScriptCore API instead 96 * 97 * Returns: A #gchar 98 */ 99 public string getData() 100 { 101 auto retStr = webkit_dom_character_data_get_data(webKitDOMCharacterData); 102 103 scope(exit) Str.freeString(retStr); 104 return Str.toString(retStr); 105 } 106 107 /** 108 * 109 * 110 * Deprecated: Use JavaScriptCore API instead 111 * 112 * Returns: A #gulong 113 */ 114 public gulong getLength() 115 { 116 return webkit_dom_character_data_get_length(webKitDOMCharacterData); 117 } 118 119 /** 120 * 121 * 122 * Deprecated: Use JavaScriptCore API instead 123 * 124 * Params: 125 * offset = A #gulong 126 * data = A #gchar 127 * 128 * Throws: GException on failure. 129 */ 130 public void insertData(gulong offset, string data) 131 { 132 GError* err = null; 133 134 webkit_dom_character_data_insert_data(webKitDOMCharacterData, offset, Str.toStringz(data), &err); 135 136 if (err !is null) 137 { 138 throw new GException( new ErrorG(err) ); 139 } 140 } 141 142 /** 143 * 144 * 145 * Deprecated: Use JavaScriptCore API instead 146 * 147 * Params: 148 * offset = A #gulong 149 * length = A #gulong 150 * data = A #gchar 151 * 152 * Throws: GException on failure. 153 */ 154 public void replaceData(gulong offset, gulong length, string data) 155 { 156 GError* err = null; 157 158 webkit_dom_character_data_replace_data(webKitDOMCharacterData, offset, length, Str.toStringz(data), &err); 159 160 if (err !is null) 161 { 162 throw new GException( new ErrorG(err) ); 163 } 164 } 165 166 /** 167 * 168 * 169 * Deprecated: Use JavaScriptCore API instead 170 * 171 * Params: 172 * value = A #gchar 173 * 174 * Throws: GException on failure. 175 */ 176 public void setData(string value) 177 { 178 GError* err = null; 179 180 webkit_dom_character_data_set_data(webKitDOMCharacterData, Str.toStringz(value), &err); 181 182 if (err !is null) 183 { 184 throw new GException( new ErrorG(err) ); 185 } 186 } 187 188 /** 189 * 190 * 191 * Deprecated: Use JavaScriptCore API instead 192 * 193 * Params: 194 * offset = A #gulong 195 * length = A #gulong 196 * 197 * Returns: A #gchar 198 * 199 * Throws: GException on failure. 200 */ 201 public string substringData(gulong offset, gulong length) 202 { 203 GError* err = null; 204 205 auto retStr = webkit_dom_character_data_substring_data(webKitDOMCharacterData, offset, length, &err); 206 207 if (err !is null) 208 { 209 throw new GException( new ErrorG(err) ); 210 } 211 212 scope(exit) Str.freeString(retStr); 213 return Str.toString(retStr); 214 } 215 }