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  * Conversion parameters:
26  * inFile  = glib-Quarks.html
27  * outPack = glib
28  * outFile = Quark
29  * strct   = GQuark
30  * realStrct=
31  * ctorStrct=
32  * clss    = Quark
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_quark_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * structWrap:
48  * module aliases:
49  * local aliases:
50  * overrides:
51  */
52 
53 module glib.Quark;
54 
55 public  import gtkc.glibtypes;
56 
57 private import gtkc.glib;
58 private import glib.ConstructionException;
59 
60 
61 private import glib.Str;
62 
63 
64 
65 
66 /**
67  * Description
68  * Quarks are associations between strings and integer identifiers.
69  * Given either the string or the GQuark identifier it is possible to
70  * retrieve the other.
71  * Quarks are used for both Datasets and Keyed Data Lists.
72  * To create a new quark from a string, use g_quark_from_string() or
73  * g_quark_from_static_string().
74  * To find the string corresponding to a given GQuark, use
75  * g_quark_to_string().
76  * To find the GQuark corresponding to a given string, use
77  * g_quark_try_string().
78  * Another use for the string pool maintained for the quark functions
79  * is string interning, using g_intern_string() or
80  * g_intern_static_string(). An interned string is a canonical
81  * representation for a string. One important advantage of interned
82  * strings is that they can be compared for equality by a simple
83  * pointer comparision, rather than using strcmp().
84  */
85 public class Quark
86 {
87 	
88 	/** the main Gtk struct */
89 	protected GQuark* gQuark;
90 	
91 	
92 	public GQuark* getQuarkStruct()
93 	{
94 		return gQuark;
95 	}
96 	
97 	
98 	/** the main Gtk struct as a void* */
99 	protected void* getStruct()
100 	{
101 		return cast(void*)gQuark;
102 	}
103 	
104 	/**
105 	 * Sets our main struct and passes it to the parent class
106 	 */
107 	public this (GQuark* gQuark)
108 	{
109 		this.gQuark = gQuark;
110 	}
111 	
112 	/**
113 	 */
114 	
115 	/**
116 	 * Gets the GQuark identifying the given string. If the string does
117 	 * not currently have an associated GQuark, a new GQuark is created,
118 	 * using a copy of the string.
119 	 * Params:
120 	 * string = a string.
121 	 * Returns: the GQuark identifying the string, or 0 if string is NULL.
122 	 */
123 	public static GQuark fromString(string string)
124 	{
125 		// GQuark g_quark_from_string (const gchar *string);
126 		return g_quark_from_string(Str.toStringz(string));
127 	}
128 	
129 	/**
130 	 * Gets the GQuark identifying the given (static) string. If the
131 	 * string does not currently have an associated GQuark, a new GQuark
132 	 * is created, linked to the given string.
133 	 * Note that this function is identical to g_quark_from_string() except
134 	 * that if a new GQuark is created the string itself is used rather
135 	 * than a copy. This saves memory, but can only be used if the string
136 	 * will always exist. It can be used with
137 	 * statically allocated strings in the main program, but not with
138 	 * statically allocated memory in dynamically loaded modules, if you
139 	 * expect to ever unload the module again (e.g. do not use this
140 	 * function in GTK+ theme engines).
141 	 * Params:
142 	 * string = a string.
143 	 * Returns: the GQuark identifying the string, or 0 if string is NULL.
144 	 */
145 	public static GQuark fromStaticString(string string)
146 	{
147 		// GQuark g_quark_from_static_string (const gchar *string);
148 		return g_quark_from_static_string(Str.toStringz(string));
149 	}
150 	
151 	/**
152 	 * Gets the string associated with the given GQuark.
153 	 * Params:
154 	 * quark = a GQuark.
155 	 * Returns: the string associated with the GQuark.
156 	 */
157 	public static string toString(GQuark quark)
158 	{
159 		// const gchar * g_quark_to_string (GQuark quark);
160 		return Str.toString(g_quark_to_string(quark));
161 	}
162 	
163 	/**
164 	 * Gets the GQuark associated with the given string, or 0 if string is
165 	 * NULL or it has no associated GQuark.
166 	 * If you want the GQuark to be created if it doesn't already exist,
167 	 * use g_quark_from_string() or g_quark_from_static_string().
168 	 * Params:
169 	 * string = a string.
170 	 * Returns: the GQuark associated with the string, or 0 if string is NULL or there is no GQuark associated with it.
171 	 */
172 	public static GQuark tryString(string string)
173 	{
174 		// GQuark g_quark_try_string (const gchar *string);
175 		return g_quark_try_string(Str.toStringz(string));
176 	}
177 	
178 	/**
179 	 * Returns a canonical representation for string. Interned strings can
180 	 * be compared for equality by comparing the pointers, instead of using strcmp().
181 	 * Since 2.10
182 	 * Params:
183 	 * string = a string
184 	 * Returns: a canonical representation for the string
185 	 */
186 	public static string gInternString(string string)
187 	{
188 		// const gchar * g_intern_string (const gchar *string);
189 		return Str.toString(g_intern_string(Str.toStringz(string)));
190 	}
191 	
192 	/**
193 	 * Returns a canonical representation for string. Interned strings can
194 	 * be compared for equality by comparing the pointers, instead of using strcmp().
195 	 * g_intern_static_string() does not copy the string, therefore string must
196 	 * not be freed or modified.
197 	 * Since 2.10
198 	 * Params:
199 	 * string = a static string
200 	 * Returns: a canonical representation for the string
201 	 */
202 	public static string gInternStaticString(string string)
203 	{
204 		// const gchar * g_intern_static_string (const gchar *string);
205 		return Str.toString(g_intern_static_string(Str.toStringz(string)));
206 	}
207 }