annotate src/value.c @ 7122:b90c94620d1c

[gaim-migrate @ 7689] A few small doc updates. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Thu, 02 Oct 2003 04:08:56 +0000
parents c53a3f0649eb
children fa6395637e2c
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 *
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8 *
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 * 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
11 * the Free Software Foundation; either version 2 of the License, or
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * (at your option) any later version.
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 *
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * GNU General Public License for more details.
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 *
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 * along with this program; if not, write to the Free Software
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 */
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 #include "internal.h"
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 "value.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 #define OUTGOING_FLAG 0x01
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 GaimValue *
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 gaim_value_new(GaimType type, ...)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32 GaimValue *value;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33 va_list args;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35 g_return_val_if_fail(type != GAIM_TYPE_UNKNOWN, NULL);
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 value = g_new0(GaimValue, 1);
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->type = type;
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 va_start(args, 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 if (type == GAIM_TYPE_SUBTYPE)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44 value->u.subtype = va_arg(args, int);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 else if (type == GAIM_TYPE_BOXED)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46 value->u.specific_type = g_strdup(va_arg(args, char *));
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 va_end(args);
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 return value;
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
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53 GaimValue *
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 gaim_value_new_outgoing(GaimType type, ...)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56 GaimValue *value;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 va_list args;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 g_return_val_if_fail(type != GAIM_TYPE_UNKNOWN, NULL);
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 value = g_new0(GaimValue, 1);
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->type = type;
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 va_start(args, 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 if (type == GAIM_TYPE_SUBTYPE)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 value->u.subtype = va_arg(args, int);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 else if (type == GAIM_TYPE_BOXED)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 value->u.specific_type = g_strdup(va_arg(args, char *));
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 va_end(args);
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 value->flags |= OUTGOING_FLAG;
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 return value;
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
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80 gaim_value_destroy(GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82 g_return_if_fail(value != NULL);
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 if (gaim_value_get_type(value) == GAIM_TYPE_BOXED)
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 (value->u.specific_type != NULL)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87 g_free(value->u.specific_type);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89 else if (gaim_value_get_type(value) == GAIM_TYPE_STRING)
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 if (value->data.string_data != NULL)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
92 g_free(value->data.string_data);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
93 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
94
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
95 g_free(value);
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
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
98 GaimType
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
99 gaim_value_get_type(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
100 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
101 g_return_val_if_fail(value != NULL, GAIM_TYPE_UNKNOWN);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
102
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
103 return value->type;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
104 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
105
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
106 unsigned int
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
107 gaim_value_get_subtype(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
108 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
109 g_return_val_if_fail(value != NULL, 0);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
110 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
111
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
112 return value->u.subtype;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
113 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
114
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
115 const char *
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
116 gaim_value_get_specific_type(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
117 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
118 g_return_val_if_fail(value != NULL, NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
119 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
120
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
121 return value->u.specific_type;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
122 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
123
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
124 gboolean
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
125 gaim_value_is_outgoing(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
126 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
127 g_return_val_if_fail(value != NULL, FALSE);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
128
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
129 return (value->flags & OUTGOING_FLAG);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
130 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
131
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
132 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
133 gaim_value_set_char(GaimValue *value, char data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
134 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
135 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
136
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
137 value->data.char_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
138 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
139
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
140 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
141 gaim_value_set_uchar(GaimValue *value, unsigned char data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
142 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
143 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
144
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
145 value->data.uchar_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
146 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
147
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
148 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
149 gaim_value_set_boolean(GaimValue *value, gboolean data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
150 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
151 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
152
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
153 value->data.boolean_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
154 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
155
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
156 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
157 gaim_value_set_short(GaimValue *value, short data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
158 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
159 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
160
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
161 value->data.short_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
162 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
163
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
164 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
165 gaim_value_set_ushort(GaimValue *value, unsigned short data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
166 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
167 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
168
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
169 value->data.ushort_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
170 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
171
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
172 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
173 gaim_value_set_int(GaimValue *value, int data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
174 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
175 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
176
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
177 value->data.int_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
178 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
179
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
180 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
181 gaim_value_set_uint(GaimValue *value, unsigned int data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
182 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
183 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
184
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
185 value->data.int_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
186 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
187
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
188 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
189 gaim_value_set_long(GaimValue *value, long data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
190 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
191 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
192
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
193 value->data.long_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
194 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
195
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
196 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
197 gaim_value_set_ulong(GaimValue *value, unsigned long data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
198 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
199 g_return_if_fail(value != NULL);
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 value->data.long_data = data;
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
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
204 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
205 gaim_value_set_int64(GaimValue *value, gint64 data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
206 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
207 g_return_if_fail(value != NULL);
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 value->data.int64_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
210 }
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 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
213 gaim_value_set_uint64(GaimValue *value, guint64 data)
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 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
216
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
217 value->data.uint64_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
218 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
219
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
220 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
221 gaim_value_set_string(GaimValue *value, const char *data)
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 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
224
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
225 if (value->data.string_data != NULL)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
226 g_free(value->data.string_data);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
227
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
228 value->data.string_data = (data == NULL ? NULL : g_strdup(data));
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
229 }
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 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
232 gaim_value_set_object(GaimValue *value, void *data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
233 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
234 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
235
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
236 value->data.object_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
237 }
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 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
240 gaim_value_set_pointer(GaimValue *value, void *data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
241 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
242 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
243
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
244 value->data.pointer_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
245 }
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 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
248 gaim_value_set_enum(GaimValue *value, int data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
249 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
250 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
251
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
252 value->data.enum_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
253 }
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 void
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
256 gaim_value_set_boxed(GaimValue *value, void *data)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
257 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
258 g_return_if_fail(value != NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
259
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
260 value->data.boxed_data = data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
261 }
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 char
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
264 gaim_value_get_char(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
265 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
266 g_return_val_if_fail(value != NULL, 0);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
267
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
268 return value->data.char_data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
269 }
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 unsigned char
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
272 gaim_value_get_uchar(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
273 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
274 g_return_val_if_fail(value != NULL, 0);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
275
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
276 return value->data.uchar_data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
277 }
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 gboolean
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
280 gaim_value_get_boolean(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
281 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
282 g_return_val_if_fail(value != NULL, FALSE);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
283
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
284 return value->data.boolean_data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
285 }
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 short
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
288 gaim_value_get_short(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
289 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
290 g_return_val_if_fail(value != NULL, 0);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
291
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
292 return value->data.short_data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
293 }
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 unsigned short
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
296 gaim_value_get_ushort(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
297 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
298 g_return_val_if_fail(value != NULL, 0);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
299
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
300 return value->data.ushort_data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
301 }
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 int
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
304 gaim_value_get_int(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
305 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
306 g_return_val_if_fail(value != NULL, 0);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
307
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
308 return value->data.int_data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
309 }
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 unsigned int
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
312 gaim_value_get_uint(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
313 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
314 g_return_val_if_fail(value != NULL, 0);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
315
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
316 return value->data.int_data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
317 }
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 long
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
320 gaim_value_get_long(const GaimValue *value)
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
321 {
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
322 g_return_val_if_fail(value != NULL, 0);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
323
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
324 return value->data.long_data;
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
325 }
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
326
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
327 unsigned long
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
328 gaim_value_get_ulong(const GaimValue *value)
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 g_return_val_if_fail(value != NULL, 0);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
331
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
332 return value->data.long_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
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
335 gint64
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
336 gaim_value_get_int64(const GaimValue *value)
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 g_return_val_if_fail(value != NULL, 0);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
339
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
340 return value->data.int64_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
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
343 guint64
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
344 gaim_value_get_uint64(const GaimValue *value)
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 g_return_val_if_fail(value != NULL, 0);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
347
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
348 return value->data.uint64_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
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
351 const char *
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
352 gaim_value_get_string(const GaimValue *value)
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 g_return_val_if_fail(value != NULL, NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
355
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
356 return value->data.string_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
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
359 void *
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
360 gaim_value_get_object(const GaimValue *value)
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 g_return_val_if_fail(value != NULL, NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
363
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
364 return value->data.object_data;
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
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
367 void *
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
368 gaim_value_get_pointer(const GaimValue *value)
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 g_return_val_if_fail(value != NULL, NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
371
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
372 return value->data.pointer_data;
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
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
375 int
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
376 gaim_value_get_enum(const GaimValue *value)
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 g_return_val_if_fail(value != NULL, -1);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
379
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
380 return value->data.enum_data;
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
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
383 void *
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
384 gaim_value_get_boxed(const GaimValue *value)
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 g_return_val_if_fail(value != NULL, NULL);
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
387
c53a3f0649eb [gaim-migrate @ 7084]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
388 return value->data.boxed_data;
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