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