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