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.Utils; 26 27 private import glib.Str; 28 private import gsv.c.functions; 29 public import gsv.c.types; 30 public import gsvc.gsvtypes; 31 32 33 /** */ 34 public struct Utils 35 { 36 37 /** 38 * Use this function to escape the following characters: `\n`, `\r`, `\t` and `\`. 39 * 40 * For a regular expression search, use g_regex_escape_string() instead. 41 * 42 * One possible use case is to take the #GtkTextBuffer's selection and put it in a 43 * search entry. The selection can contain tabulations, newlines, etc. So it's 44 * better to escape those special characters to better fit in the search entry. 45 * 46 * See also: gtk_source_utils_unescape_search_text(). 47 * 48 * <warning> 49 * Warning: the escape and unescape functions are not reciprocal! For example, 50 * escape (unescape (\)) = \\. So avoid cycles such as: search entry -> unescape 51 * -> search settings -> escape -> search entry. The original search entry text 52 * may be modified. 53 * </warning> 54 * 55 * Params: 56 * text = the text to escape. 57 * 58 * Returns: the escaped @text. 59 * 60 * Since: 3.10 61 */ 62 public static string escapeSearchText(string text) 63 { 64 auto retStr = gtk_source_utils_escape_search_text(Str.toStringz(text)); 65 66 scope(exit) Str.freeString(retStr); 67 return Str.toString(retStr); 68 } 69 70 /** 71 * Use this function before gtk_source_search_settings_set_search_text(), to 72 * unescape the following sequences of characters: `\n`, `\r`, `\t` and `\\`. 73 * The purpose is to easily write those characters in a search entry. 74 * 75 * Note that unescaping the search text is not needed for regular expression 76 * searches. 77 * 78 * See also: gtk_source_utils_escape_search_text(). 79 * 80 * Params: 81 * text = the text to unescape. 82 * 83 * Returns: the unescaped @text. 84 * 85 * Since: 3.10 86 */ 87 public static string unescapeSearchText(string text) 88 { 89 auto retStr = gtk_source_utils_unescape_search_text(Str.toStringz(text)); 90 91 scope(exit) Str.freeString(retStr); 92 return Str.toString(retStr); 93 } 94 }