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 glib.c.functions;
29 public  import glib.c.types;
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 	 * This function must not be used before library constructors have finished
43 	 * running. In particular, this means it cannot be used to initialize global
44 	 * variables in C++.
45 	 *
46 	 * Params:
47 	 *     string_ = a static string
48 	 *
49 	 * Returns: a canonical representation for the string
50 	 *
51 	 * Since: 2.10
52 	 */
53 	public static string internStaticString(string string_)
54 	{
55 		return Str.toString(g_intern_static_string(Str.toStringz(string_)));
56 	}
57 
58 	/**
59 	 * Returns a canonical representation for @string. Interned strings
60 	 * can be compared for equality by comparing the pointers, instead of
61 	 * using strcmp().
62 	 *
63 	 * This function must not be used before library constructors have finished
64 	 * running. In particular, this means it cannot be used to initialize global
65 	 * variables in C++.
66 	 *
67 	 * Params:
68 	 *     string_ = a string
69 	 *
70 	 * Returns: a canonical representation for the string
71 	 *
72 	 * Since: 2.10
73 	 */
74 	public static string internString(string string_)
75 	{
76 		return Str.toString(g_intern_string(Str.toStringz(string_)));
77 	}
78 
79 	/**
80 	 * Gets the #GQuark identifying the given (static) string. If the
81 	 * string does not currently have an associated #GQuark, a new #GQuark
82 	 * is created, linked to the given string.
83 	 *
84 	 * Note that this function is identical to g_quark_from_string() except
85 	 * that if a new #GQuark is created the string itself is used rather
86 	 * than a copy. This saves memory, but can only be used if the string
87 	 * will continue to exist until the program terminates. It can be used
88 	 * with statically allocated strings in the main program, but not with
89 	 * statically allocated memory in dynamically loaded modules, if you
90 	 * expect to ever unload the module again (e.g. do not use this
91 	 * function in GTK+ theme engines).
92 	 *
93 	 * This function must not be used before library constructors have finished
94 	 * running. In particular, this means it cannot be used to initialize global
95 	 * variables in C++.
96 	 *
97 	 * Params:
98 	 *     string_ = a string
99 	 *
100 	 * Returns: the #GQuark identifying the string, or 0 if @string is %NULL
101 	 */
102 	public static GQuark quarkFromStaticString(string string_)
103 	{
104 		return g_quark_from_static_string(Str.toStringz(string_));
105 	}
106 
107 	/**
108 	 * Gets the #GQuark identifying the given string. If the string does
109 	 * not currently have an associated #GQuark, a new #GQuark is created,
110 	 * using a copy of the string.
111 	 *
112 	 * This function must not be used before library constructors have finished
113 	 * running. In particular, this means it cannot be used to initialize global
114 	 * variables in C++.
115 	 *
116 	 * Params:
117 	 *     string_ = a string
118 	 *
119 	 * Returns: the #GQuark identifying the string, or 0 if @string is %NULL
120 	 */
121 	public static GQuark quarkFromString(string string_)
122 	{
123 		return g_quark_from_string(Str.toStringz(string_));
124 	}
125 
126 	/**
127 	 * Gets the string associated with the given #GQuark.
128 	 *
129 	 * Params:
130 	 *     quark = a #GQuark.
131 	 *
132 	 * Returns: the string associated with the #GQuark
133 	 */
134 	public static string quarkToString(GQuark quark)
135 	{
136 		return Str.toString(g_quark_to_string(quark));
137 	}
138 
139 	/**
140 	 * Gets the #GQuark associated with the given string, or 0 if string is
141 	 * %NULL or it has no associated #GQuark.
142 	 *
143 	 * If you want the GQuark to be created if it doesn't already exist,
144 	 * use g_quark_from_string() or g_quark_from_static_string().
145 	 *
146 	 * This function must not be used before library constructors have finished
147 	 * running.
148 	 *
149 	 * Params:
150 	 *     string_ = a string
151 	 *
152 	 * Returns: the #GQuark associated with the string, or 0 if @string is
153 	 *     %NULL or there is no #GQuark associated with it
154 	 */
155 	public static GQuark quarkTryString(string string_)
156 	{
157 		return g_quark_try_string(Str.toStringz(string_));
158 	}
159 }