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 glib.Quark;
26 
27 private import glib.Str;
28 private import gtkc.glib;
29 public  import gtkc.glibtypes;
30 
31 
32 /** */
33 public struct Quark
34 {
35 
36 	/**
37 	 * Returns a canonical representation for @string. Interned strings
38 	 * can be compared for equality by comparing the pointers, instead of
39 	 * using strcmp(). g_intern_static_string() does not copy the string,
40 	 * therefore @string must not be freed or modified.
41 	 *
42 	 * Params:
43 	 *     str = a static string
44 	 *
45 	 * Returns: a canonical representation for the string
46 	 *
47 	 * Since: 2.10
48 	 */
49 	public static string internStaticString(string str)
50 	{
51 		return Str.toString(g_intern_static_string(Str.toStringz(str)));
52 	}
53 
54 	/**
55 	 * Returns a canonical representation for @string. Interned strings
56 	 * can be compared for equality by comparing the pointers, instead of
57 	 * using strcmp().
58 	 *
59 	 * Params:
60 	 *     str = a string
61 	 *
62 	 * Returns: a canonical representation for the string
63 	 *
64 	 * Since: 2.10
65 	 */
66 	public static string internString(string str)
67 	{
68 		return Str.toString(g_intern_string(Str.toStringz(str)));
69 	}
70 
71 	/**
72 	 * Gets the #GQuark identifying the given (static) string. If the
73 	 * string does not currently have an associated #GQuark, a new #GQuark
74 	 * is created, linked to the given string.
75 	 *
76 	 * Note that this function is identical to g_quark_from_string() except
77 	 * that if a new #GQuark is created the string itself is used rather
78 	 * than a copy. This saves memory, but can only be used if the string
79 	 * will continue to exist until the program terminates. It can be used
80 	 * with statically allocated strings in the main program, but not with
81 	 * statically allocated memory in dynamically loaded modules, if you
82 	 * expect to ever unload the module again (e.g. do not use this
83 	 * function in GTK+ theme engines).
84 	 *
85 	 * Params:
86 	 *     str = a string
87 	 *
88 	 * Returns: the #GQuark identifying the string, or 0 if @string is %NULL
89 	 */
90 	public static GQuark quarkFromStaticString(string str)
91 	{
92 		return g_quark_from_static_string(Str.toStringz(str));
93 	}
94 
95 	/**
96 	 * Gets the #GQuark identifying the given string. If the string does
97 	 * not currently have an associated #GQuark, a new #GQuark is created,
98 	 * using a copy of the string.
99 	 *
100 	 * Params:
101 	 *     str = a string
102 	 *
103 	 * Returns: the #GQuark identifying the string, or 0 if @string is %NULL
104 	 */
105 	public static GQuark quarkFromString(string str)
106 	{
107 		return g_quark_from_string(Str.toStringz(str));
108 	}
109 
110 	/**
111 	 * Gets the string associated with the given #GQuark.
112 	 *
113 	 * Params:
114 	 *     quark = a #GQuark.
115 	 *
116 	 * Returns: the string associated with the #GQuark
117 	 */
118 	public static string quarkToString(GQuark quark)
119 	{
120 		return Str.toString(g_quark_to_string(quark));
121 	}
122 
123 	/**
124 	 * Gets the #GQuark associated with the given string, or 0 if string is
125 	 * %NULL or it has no associated #GQuark.
126 	 *
127 	 * If you want the GQuark to be created if it doesn't already exist,
128 	 * use g_quark_from_string() or g_quark_from_static_string().
129 	 *
130 	 * Params:
131 	 *     str = a string
132 	 *
133 	 * Returns: the #GQuark associated with the string, or 0 if @string is
134 	 *     %NULL or there is no #GQuark associated with it
135 	 */
136 	public static GQuark quarkTryString(string str)
137 	{
138 		return g_quark_try_string(Str.toStringz(str));
139 	}
140 }