| |
1 /* |
| |
2 * purple |
| |
3 * |
| |
4 * Purple is the legal property of its developers, whose names are too numerous |
| |
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
| |
6 * source distribution. |
| |
7 * |
| |
8 * This program is free software; you can redistribute it and/or modify |
| |
9 * it under the terms of the GNU General Public License as published by |
| |
10 * the Free Software Foundation; either version 2 of the License, or |
| |
11 * (at your option) any later version. |
| |
12 * |
| |
13 * This program is distributed in the hope that it will be useful, |
| |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| |
16 * GNU General Public License for more details. |
| |
17 * |
| |
18 * You should have received a copy of the GNU General Public License |
| |
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| |
20 */ |
| |
21 |
| |
22 #ifndef PURPLE_KEY_VALUE_PAIR_H |
| |
23 #define PURPLE_KEY_VALUE_PAIR_H |
| |
24 |
| |
25 /** |
| |
26 * SECTION:purplekeyvaluepair |
| |
27 * @section_id: libpurple-key-value-pair |
| |
28 * @short_description: <filename>purplekeyvaluepair.h</filename> |
| |
29 * @title: Key Value Pairs |
| |
30 */ |
| |
31 |
| |
32 #define PURPLE_TYPE_KEY_VALUE_PAIR (purple_key_value_pair_get_type()) |
| |
33 |
| |
34 /** |
| |
35 * PurpleKeyValuePair: |
| |
36 * @key: The key |
| |
37 * @value: The value |
| |
38 * @value_destroy_func: A #GDestroyNotify to free @value when |
| |
39 * purple_key_value_pair_free() is called. |
| |
40 * |
| |
41 * A key-value pair. |
| |
42 * |
| |
43 * This is used by, among other things, purple_gtk_combo* functions to pass in |
| |
44 * a list of key-value pairs so it can display a user-friendly value. |
| |
45 */ |
| |
46 typedef struct _PurpleKeyValuePair PurpleKeyValuePair; |
| |
47 |
| |
48 #include <glib.h> |
| |
49 #include <glib-object.h> |
| |
50 |
| |
51 G_BEGIN_DECLS |
| |
52 |
| |
53 struct _PurpleKeyValuePair { |
| |
54 gchar *key; |
| |
55 gpointer value; |
| |
56 GDestroyNotify value_destroy_func; |
| |
57 }; |
| |
58 |
| |
59 /** |
| |
60 * purple_key_value_pair_get_type: |
| |
61 * |
| |
62 * The standard %_GET_TYPE function for #PurpleKeyValuePair. |
| |
63 * |
| |
64 * Returns: The #GType for #PurpleKeyValuePair. |
| |
65 */ |
| |
66 GType purple_key_value_pair_get_type(void); |
| |
67 |
| |
68 /** |
| |
69 * purple_key_value_pair_new: |
| |
70 * @key: The key part of PurpleKeyValuePair |
| |
71 * @value: The value part of PurpleKeyValuePair |
| |
72 * |
| |
73 * Creates a new PurpleKeyValuePair allocating memory for @key, |
| |
74 * free value function is NULL. |
| |
75 * |
| |
76 * Returns: (transfer full): The created PurpleKeyValuePair |
| |
77 * |
| |
78 * Since: 3.0.0 |
| |
79 */ |
| |
80 PurpleKeyValuePair *purple_key_value_pair_new(const gchar *key, gpointer value); |
| |
81 |
| |
82 /** |
| |
83 * purple_key_value_pair_new_full: |
| |
84 * @key: The key part of PurpleKeyValuePair |
| |
85 * @value: The value part of PurpleKeyValuePair |
| |
86 * @value_destroy_func: a function to free the memory for the @value |
| |
87 * |
| |
88 * Creates a new PurpleKeyValuePair allocating memory for @key, |
| |
89 * set free value function to @value_destroy_func. |
| |
90 * |
| |
91 * Returns: (transfer full): The created PurpleKeyValuePair |
| |
92 * |
| |
93 * Since: 3.0.0 |
| |
94 */ |
| |
95 PurpleKeyValuePair *purple_key_value_pair_new_full(const gchar *key, gpointer value, GDestroyNotify value_destroy_func); |
| |
96 |
| |
97 /** |
| |
98 * purple_key_value_pair_free: |
| |
99 * @kvp: The PurpleKeyValuePair to free. |
| |
100 * |
| |
101 * Frees @kvp. |
| |
102 * |
| |
103 * Since: 3.0.0 |
| |
104 */ |
| |
105 void purple_key_value_pair_free(PurpleKeyValuePair *kvp); |
| |
106 |
| |
107 /** |
| |
108 * purple_key_value_pair_copy: |
| |
109 * @kvp: The #PurpleKeyValuePair to copy. |
| |
110 * |
| |
111 * Creates a copy of @kvp. |
| |
112 * |
| |
113 * Returns: (transfer full): A new copy of @kvp. |
| |
114 */ |
| |
115 PurpleKeyValuePair *purple_key_value_pair_copy(PurpleKeyValuePair *kvp); |
| |
116 |
| |
117 G_END_DECLS |
| |
118 |
| |
119 #endif /* PURPLE_KEY_VALUE_PAIR_H */ |
| |
120 |