2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = glib-Quarks.html
57 import tango
.io
.Stdout
; // use the tango loging?
61 private import gtkc
.glibtypes
;
63 private import gtkc
.glib
;
66 private import glib
.ErrorG
;
67 private import glib
.Str
;
74 * Quarks are associations between strings and integer identifiers.
75 * Given either the string or the GQuark identifier it is possible to
77 * Quarks are used for both
80 * To create a new quark from a string, use g_quark_from_string() or
81 * g_quark_from_static_string().
82 * To find the string corresponding to a given GQuark, use g_quark_to_string().
83 * To find the GQuark corresponding to a given string, use g_quark_try_string().
84 * Another use for the string pool maintained for the quark functions is string
85 * interning, using g_intern_string() or g_intern_static_string(). An interned string
86 * is a canonical representation for a string. One important advantage of interned strings
87 * is that they can be compared for equality by a simple pointer comparision, rather than
93 /** the main Gtk struct */
94 protected GQuark
* gQuark
;
97 public GQuark
* getQuarkStruct()
103 /** the main Gtk struct as a void* */
104 protected void* getStruct()
106 return cast(void*)gQuark
;
110 * Sets our main struct and passes it to the parent class
112 public this (GQuark
* gQuark
)
116 if ( gQuark
is null )
121 Stdout("struct gQuark is null on constructor").newline
;
125 printf("struct gQuark is null on constructor");
132 assert(gQuark
!is null, "struct gQuark is null on constructor");
134 this.gQuark
= gQuark
;
142 * Gets the GQuark identifying the given string.
143 * If the string does not currently have an associated GQuark, a new
144 * GQuark is created, using a copy of the string.
148 * the GQuark identifying the string.
150 public static GQuark
fromString(char[] string
)
152 // GQuark g_quark_from_string (const gchar *string);
153 return g_quark_from_string(Str
.toStringz(string
));
157 * Gets the GQuark identifying the given (static) string.
158 * If the string does not currently have an associated GQuark, a new
159 * GQuark is created, linked to the given string.
160 * Note that this function is identical to g_quark_from_string() except
161 * that if a new GQuark is created the string itself is used rather than
162 * a copy. This saves memory, but can only be used if the string will
163 * always exist. It can be used with statically
164 * allocated strings in the main program, but not with statically
165 * allocated memory in dynamically loaded modules, if you expect to
166 * ever unload the module again (e.g. do not use this function in
167 * GTK+ theme engines).
171 * the GQuark identifying the string.
173 public static GQuark
fromStaticString(char[] string
)
175 // GQuark g_quark_from_static_string (const gchar *string);
176 return g_quark_from_static_string(Str
.toStringz(string
));
180 * Gets the string associated with the given GQuark.
184 * the string associated with the GQuark.
186 public static char[] toString(GQuark quark
)
188 // const gchar* g_quark_to_string (GQuark quark);
189 return Str
.toString(g_quark_to_string(quark
) );
193 * Gets the GQuark associated with the given string, or 0 if the string has
194 * no associated GQuark.
195 * If you want the GQuark to be created if it doesn't already exist, use
196 * g_quark_from_string() or g_quark_from_static_string().
200 * the GQuark associated with the string, or 0 if there is no
201 * GQuark associated with the string.
203 public static GQuark
tryString(char[] string
)
205 // GQuark g_quark_try_string (const gchar *string);
206 return g_quark_try_string(Str
.toStringz(string
));
210 * Returns a canonical representation for string. Interned strings can
211 * be compared for equality by comparing the pointers, instead of using strcmp().
215 * a canonical representation for the string
218 public static char[] gInternString(char[] string
)
220 // const gchar* g_intern_string (const gchar *string);
221 return Str
.toString(g_intern_string(Str
.toStringz(string
)) );
225 * Returns a canonical representation for string. Interned strings can
226 * be compared for equality by comparing the pointers, instead of using strcmp().
227 * g_intern_static_string() does not copy the string, therefore string must
228 * not be freed or modified.
232 * a canonical representation for the string
235 public static char[] gInternStaticString(char[] string
)
237 // const gchar* g_intern_static_string (const gchar *string);
238 return Str
.toString(g_intern_static_string(Str
.toStringz(string
)) );