source: appstream-generator/build/girepo/glib/Quark.d @ 4841

Last change on this file since 4841 was 4841, checked in by Juanma, 2 years ago

Initial release

File size: 3.9 KB
Line 
1/*
2 * Licensed under the GNU Lesser General Public License Version 3
3 *
4 * This library 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 3 of the license, or
7 * (at your option) any later version.
8 *
9 * This software 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.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18// generated automatically - do not change
19
20
21module glib.Quark;
22
23private import gi.glib;
24public  import gi.glibtypes;
25private import glib.Str;
26
27
28/** */
29public struct Quark
30{
31
32        /**
33         * Returns a canonical representation for @string. Interned strings
34         * can be compared for equality by comparing the pointers, instead of
35         * using strcmp(). g_intern_static_string() does not copy the string,
36         * therefore @string must not be freed or modified.
37         *
38         * Params:
39         *     str = a static string
40         *
41         * Returns: a canonical representation for the string
42         *
43         * Since: 2.10
44         */
45        public static string internStaticString(string str)
46        {
47                return Str.toString(g_intern_static_string(Str.toStringz(str)));
48        }
49
50        /**
51         * Returns a canonical representation for @string. Interned strings
52         * can be compared for equality by comparing the pointers, instead of
53         * using strcmp().
54         *
55         * Params:
56         *     str = a string
57         *
58         * Returns: a canonical representation for the string
59         *
60         * Since: 2.10
61         */
62        public static string internString(string str)
63        {
64                return Str.toString(g_intern_string(Str.toStringz(str)));
65        }
66
67        /**
68         * Gets the #GQuark identifying the given (static) string. If the
69         * string does not currently have an associated #GQuark, a new #GQuark
70         * is created, linked to the given string.
71         *
72         * Note that this function is identical to g_quark_from_string() except
73         * that if a new #GQuark is created the string itself is used rather
74         * than a copy. This saves memory, but can only be used if the string
75         * will continue to exist until the program terminates. It can be used
76         * with statically allocated strings in the main program, but not with
77         * statically allocated memory in dynamically loaded modules, if you
78         * expect to ever unload the module again (e.g. do not use this
79         * function in GTK+ theme engines).
80         *
81         * Params:
82         *     str = a string
83         *
84         * Returns: the #GQuark identifying the string, or 0 if @string is %NULL
85         */
86        public static GQuark quarkFromStaticString(string str)
87        {
88                return g_quark_from_static_string(Str.toStringz(str));
89        }
90
91        /**
92         * Gets the #GQuark identifying the given string. If the string does
93         * not currently have an associated #GQuark, a new #GQuark is created,
94         * using a copy of the string.
95         *
96         * Params:
97         *     str = a string
98         *
99         * Returns: the #GQuark identifying the string, or 0 if @string is %NULL
100         */
101        public static GQuark quarkFromString(string str)
102        {
103                return g_quark_from_string(Str.toStringz(str));
104        }
105
106        /**
107         * Gets the string associated with the given #GQuark.
108         *
109         * Params:
110         *     quark = a #GQuark.
111         *
112         * Returns: the string associated with the #GQuark
113         */
114        public static string quarkToString(GQuark quark)
115        {
116                return Str.toString(g_quark_to_string(quark));
117        }
118
119        /**
120         * Gets the #GQuark associated with the given string, or 0 if string is
121         * %NULL or it has no associated #GQuark.
122         *
123         * If you want the GQuark to be created if it doesn't already exist,
124         * use g_quark_from_string() or g_quark_from_static_string().
125         *
126         * Params:
127         *     str = a string
128         *
129         * Returns: the #GQuark associated with the string, or 0 if @string is
130         *     %NULL or there is no #GQuark associated with it
131         */
132        public static GQuark quarkTryString(string str)
133        {
134                return g_quark_try_string(Str.toStringz(str));
135        }
136}
Note: See TracBrowser for help on using the repository browser.