annotate src/value.c @ 13745:fcb3f77df50d

[gaim-migrate @ 16156] Clarify this a tiny bit committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 08 May 2006 04:02:50 +0000
parents fde4101fa183
children 8bda65b88e49
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6562
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /**
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 * @file value.c Value wrapper API
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 * @ingroup core
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 *
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 * gaim
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 *
8046
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 6562
diff changeset
7 * Gaim is the legal property of its developers, whose names are too numerous
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 6562
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 6562
diff changeset
9 * source distribution.
6562
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 *
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * (at your option) any later version.
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 *
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * GNU General Public License for more details.
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 *
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 */
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 #include "internal.h"
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27 #include "value.h"
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
28
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 #define OUTGOING_FLAG 0x01
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31 GaimValue *
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32 gaim_value_new(GaimType type, ...)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34 GaimValue *value;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35 va_list args;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 g_return_val_if_fail(type != GAIM_TYPE_UNKNOWN, NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39 value = g_new0(GaimValue, 1);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41 value->type = type;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43 va_start(args, type);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 if (type == GAIM_TYPE_SUBTYPE)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46 value->u.subtype = va_arg(args, int);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47 else if (type == GAIM_TYPE_BOXED)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 value->u.specific_type = g_strdup(va_arg(args, char *));
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50 va_end(args);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 return value;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55 GaimValue *
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56 gaim_value_new_outgoing(GaimType type, ...)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58 GaimValue *value;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 va_list args;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61 g_return_val_if_fail(type != GAIM_TYPE_UNKNOWN, NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
63 value = g_new0(GaimValue, 1);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65 value->type = type;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67 va_start(args, type);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 if (type == GAIM_TYPE_SUBTYPE)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 value->u.subtype = va_arg(args, int);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71 else if (type == GAIM_TYPE_BOXED)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 value->u.specific_type = g_strdup(va_arg(args, char *));
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74 va_end(args);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76 value->flags |= OUTGOING_FLAG;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
77
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
78 return value;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82 gaim_value_destroy(GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
86 if (gaim_value_get_type(value) == GAIM_TYPE_BOXED)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88 if (value->u.specific_type != NULL)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89 g_free(value->u.specific_type);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
90 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
91 else if (gaim_value_get_type(value) == GAIM_TYPE_STRING)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
92 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
93 if (value->data.string_data != NULL)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
94 g_free(value->data.string_data);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
95 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
96
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
97 g_free(value);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
98 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
99
8809
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
100 GaimValue *
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
101 gaim_value_dup(const GaimValue *value)
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
102 {
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
103 GaimValue *new_value;
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
104 GaimType type;
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
105
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
106 g_return_val_if_fail(value != NULL, NULL);
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
107
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
108 type = gaim_value_get_type(value);
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
109
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
110 if (type == GAIM_TYPE_SUBTYPE)
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
111 {
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
112 new_value = gaim_value_new(GAIM_TYPE_SUBTYPE,
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
113 gaim_value_get_subtype(value));
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
114 }
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
115 else if (type == GAIM_TYPE_BOXED)
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
116 {
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
117 new_value = gaim_value_new(GAIM_TYPE_BOXED,
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
118 gaim_value_get_specific_type(value));
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
119 }
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
120 else
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
121 new_value = gaim_value_new(type);
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
122
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
123 new_value->flags = value->flags;
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
124
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
125 switch (type)
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
126 {
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
127 case GAIM_TYPE_CHAR:
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
128 gaim_value_set_char(new_value, gaim_value_get_char(value));
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
129 break;
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
130
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
131 case GAIM_TYPE_UCHAR:
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
132 gaim_value_set_uchar(new_value, gaim_value_get_uchar(value));
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
133 break;
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
134
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
135 case GAIM_TYPE_BOOLEAN:
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
136 gaim_value_set_boolean(new_value, gaim_value_get_boolean(value));
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
137 break;
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
138
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
139 case GAIM_TYPE_SHORT:
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
140 gaim_value_set_short(new_value, gaim_value_get_short(value));
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
141 break;
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
142
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
143 case GAIM_TYPE_USHORT:
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
144 gaim_value_set_ushort(new_value, gaim_value_get_ushort(value));
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
145 break;
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
146
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
147 case GAIM_TYPE_INT:
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
148 gaim_value_set_int(new_value, gaim_value_get_int(value));
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
149 break;
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
150
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
151 case GAIM_TYPE_UINT:
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
152 gaim_value_set_uint(new_value, gaim_value_get_uint(value));
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
153 break;
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
154
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
155 case GAIM_TYPE_LONG:
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
156 gaim_value_set_long(new_value, gaim_value_get_long(value));
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
157 break;
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
158
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
159 case GAIM_TYPE_ULONG:
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
160 gaim_value_set_ulong(new_value, gaim_value_get_ulong(value));
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
161 break;
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
162
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
163 case GAIM_TYPE_INT64:
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
164 gaim_value_set_int64(new_value, gaim_value_get_int64(value));
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
165 break;
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
166
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
167 case GAIM_TYPE_UINT64:
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
168 gaim_value_set_uint64(new_value, gaim_value_get_uint64(value));
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
169 break;
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
170
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
171 case GAIM_TYPE_STRING:
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
172 gaim_value_set_string(new_value, gaim_value_get_string(value));
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
173 break;
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
174
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
175 case GAIM_TYPE_OBJECT:
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
176 gaim_value_set_object(new_value, gaim_value_get_object(value));
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
177 break;
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
178
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
179 case GAIM_TYPE_POINTER:
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
180 gaim_value_set_pointer(new_value, gaim_value_get_pointer(value));
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
181 break;
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
182
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
183 case GAIM_TYPE_ENUM:
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
184 gaim_value_set_enum(new_value, gaim_value_get_enum(value));
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
185 break;
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
186
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
187 case GAIM_TYPE_BOXED:
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
188 gaim_value_set_boxed(new_value, gaim_value_get_boxed(value));
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
189 break;
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
190
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
191 default:
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
192 break;
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
193 }
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
194
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
195 return new_value;
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
196 }
fde4101fa183 [gaim-migrate @ 9571]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
197
6562
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
198 GaimType
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
199 gaim_value_get_type(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
200 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
201 g_return_val_if_fail(value != NULL, GAIM_TYPE_UNKNOWN);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
202
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
203 return value->type;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
204 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
205
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
206 unsigned int
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
207 gaim_value_get_subtype(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
208 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
209 g_return_val_if_fail(value != NULL, 0);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
210 g_return_val_if_fail(gaim_value_get_type(value) == GAIM_TYPE_SUBTYPE, 0);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
211
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
212 return value->u.subtype;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
213 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
214
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
215 const char *
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
216 gaim_value_get_specific_type(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
217 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
218 g_return_val_if_fail(value != NULL, NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
219 g_return_val_if_fail(gaim_value_get_type(value) == GAIM_TYPE_BOXED, NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
220
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
221 return value->u.specific_type;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
222 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
223
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
224 gboolean
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
225 gaim_value_is_outgoing(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
226 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
227 g_return_val_if_fail(value != NULL, FALSE);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
228
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
229 return (value->flags & OUTGOING_FLAG);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
230 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
231
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
232 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
233 gaim_value_set_char(GaimValue *value, char data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
234 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
235 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
236
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
237 value->data.char_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
238 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
239
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
240 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
241 gaim_value_set_uchar(GaimValue *value, unsigned char data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
242 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
243 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
244
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
245 value->data.uchar_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
246 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
247
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
248 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
249 gaim_value_set_boolean(GaimValue *value, gboolean data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
250 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
251 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
252
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
253 value->data.boolean_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
254 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
255
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
256 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
257 gaim_value_set_short(GaimValue *value, short data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
258 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
259 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
260
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
261 value->data.short_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
262 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
263
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
264 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
265 gaim_value_set_ushort(GaimValue *value, unsigned short data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
266 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
267 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
268
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
269 value->data.ushort_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
270 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
271
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
272 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
273 gaim_value_set_int(GaimValue *value, int data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
274 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
275 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
276
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
277 value->data.int_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
278 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
279
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
280 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
281 gaim_value_set_uint(GaimValue *value, unsigned int data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
282 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
283 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
284
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
285 value->data.int_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
286 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
287
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
288 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
289 gaim_value_set_long(GaimValue *value, long data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
290 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
291 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
292
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
293 value->data.long_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
294 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
295
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
296 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
297 gaim_value_set_ulong(GaimValue *value, unsigned long data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
298 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
299 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
300
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
301 value->data.long_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
302 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
303
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
304 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
305 gaim_value_set_int64(GaimValue *value, gint64 data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
306 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
307 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
308
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
309 value->data.int64_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
310 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
311
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
312 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
313 gaim_value_set_uint64(GaimValue *value, guint64 data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
314 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
315 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
316
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
317 value->data.uint64_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
318 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
319
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
320 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
321 gaim_value_set_string(GaimValue *value, const char *data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
322 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
323 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
324
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
325 if (value->data.string_data != NULL)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
326 g_free(value->data.string_data);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
327
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
328 value->data.string_data = (data == NULL ? NULL : g_strdup(data));
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
329 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
330
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
331 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
332 gaim_value_set_object(GaimValue *value, void *data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
333 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
334 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
335
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
336 value->data.object_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
337 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
338
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
339 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
340 gaim_value_set_pointer(GaimValue *value, void *data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
341 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
342 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
343
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
344 value->data.pointer_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
345 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
346
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
347 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
348 gaim_value_set_enum(GaimValue *value, int data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
349 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
350 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
351
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
352 value->data.enum_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
353 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
354
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
355 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
356 gaim_value_set_boxed(GaimValue *value, void *data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
357 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
358 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
359
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
360 value->data.boxed_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
361 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
362
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
363 char
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
364 gaim_value_get_char(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
365 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
366 g_return_val_if_fail(value != NULL, 0);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
367
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
368 return value->data.char_data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
369 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
370
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
371 unsigned char
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
372 gaim_value_get_uchar(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
373 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
374 g_return_val_if_fail(value != NULL, 0);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
375
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
376 return value->data.uchar_data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
377 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
378
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
379 gboolean
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
380 gaim_value_get_boolean(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
381 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
382 g_return_val_if_fail(value != NULL, FALSE);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
383
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
384 return value->data.boolean_data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
385 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
386
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
387 short
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
388 gaim_value_get_short(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
389 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
390 g_return_val_if_fail(value != NULL, 0);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
391
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
392 return value->data.short_data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
393 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
394
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
395 unsigned short
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
396 gaim_value_get_ushort(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
397 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
398 g_return_val_if_fail(value != NULL, 0);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
399
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
400 return value->data.ushort_data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
401 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
402
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
403 int
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
404 gaim_value_get_int(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
405 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
406 g_return_val_if_fail(value != NULL, 0);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
407
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
408 return value->data.int_data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
409 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
410
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
411 unsigned int
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
412 gaim_value_get_uint(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
413 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
414 g_return_val_if_fail(value != NULL, 0);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
415
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
416 return value->data.int_data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
417 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
418
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
419 long
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
420 gaim_value_get_long(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
421 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
422 g_return_val_if_fail(value != NULL, 0);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
423
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
424 return value->data.long_data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
425 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
426
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
427 unsigned long
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
428 gaim_value_get_ulong(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
429 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
430 g_return_val_if_fail(value != NULL, 0);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
431
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
432 return value->data.long_data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
433 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
434
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
435 gint64
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
436 gaim_value_get_int64(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
437 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
438 g_return_val_if_fail(value != NULL, 0);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
439
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
440 return value->data.int64_data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
441 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
442
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
443 guint64
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
444 gaim_value_get_uint64(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
445 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
446 g_return_val_if_fail(value != NULL, 0);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
447
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
448 return value->data.uint64_data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
449 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
450
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
451 const char *
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
452 gaim_value_get_string(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
453 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
454 g_return_val_if_fail(value != NULL, NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
455
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
456 return value->data.string_data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
457 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
458
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
459 void *
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
460 gaim_value_get_object(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
461 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
462 g_return_val_if_fail(value != NULL, NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
463
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
464 return value->data.object_data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
465 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
466
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
467 void *
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
468 gaim_value_get_pointer(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
469 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
470 g_return_val_if_fail(value != NULL, NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
471
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
472 return value->data.pointer_data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
473 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
474
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
475 int
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
476 gaim_value_get_enum(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
477 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
478 g_return_val_if_fail(value != NULL, -1);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
479
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
480 return value->data.enum_data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
481 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
482
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
483 void *
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
484 gaim_value_get_boxed(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
485 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
486 g_return_val_if_fail(value != NULL, NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
487
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
488 return value->data.boxed_data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
489 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
490