Mercurial > pidgin
comparison src/value.c @ 8809:fde4101fa183
[gaim-migrate @ 9571]
Added the GaimValue changes from my status rewrite tree to here.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sun, 25 Apr 2004 22:31:50 +0000 |
parents | fa6395637e2c |
children | 8bda65b88e49 |
comparison
equal
deleted
inserted
replaced
8808:bbd8cdaf0ad5 | 8809:fde4101fa183 |
---|---|
95 } | 95 } |
96 | 96 |
97 g_free(value); | 97 g_free(value); |
98 } | 98 } |
99 | 99 |
100 GaimValue * | |
101 gaim_value_dup(const GaimValue *value) | |
102 { | |
103 GaimValue *new_value; | |
104 GaimType type; | |
105 | |
106 g_return_val_if_fail(value != NULL, NULL); | |
107 | |
108 type = gaim_value_get_type(value); | |
109 | |
110 if (type == GAIM_TYPE_SUBTYPE) | |
111 { | |
112 new_value = gaim_value_new(GAIM_TYPE_SUBTYPE, | |
113 gaim_value_get_subtype(value)); | |
114 } | |
115 else if (type == GAIM_TYPE_BOXED) | |
116 { | |
117 new_value = gaim_value_new(GAIM_TYPE_BOXED, | |
118 gaim_value_get_specific_type(value)); | |
119 } | |
120 else | |
121 new_value = gaim_value_new(type); | |
122 | |
123 new_value->flags = value->flags; | |
124 | |
125 switch (type) | |
126 { | |
127 case GAIM_TYPE_CHAR: | |
128 gaim_value_set_char(new_value, gaim_value_get_char(value)); | |
129 break; | |
130 | |
131 case GAIM_TYPE_UCHAR: | |
132 gaim_value_set_uchar(new_value, gaim_value_get_uchar(value)); | |
133 break; | |
134 | |
135 case GAIM_TYPE_BOOLEAN: | |
136 gaim_value_set_boolean(new_value, gaim_value_get_boolean(value)); | |
137 break; | |
138 | |
139 case GAIM_TYPE_SHORT: | |
140 gaim_value_set_short(new_value, gaim_value_get_short(value)); | |
141 break; | |
142 | |
143 case GAIM_TYPE_USHORT: | |
144 gaim_value_set_ushort(new_value, gaim_value_get_ushort(value)); | |
145 break; | |
146 | |
147 case GAIM_TYPE_INT: | |
148 gaim_value_set_int(new_value, gaim_value_get_int(value)); | |
149 break; | |
150 | |
151 case GAIM_TYPE_UINT: | |
152 gaim_value_set_uint(new_value, gaim_value_get_uint(value)); | |
153 break; | |
154 | |
155 case GAIM_TYPE_LONG: | |
156 gaim_value_set_long(new_value, gaim_value_get_long(value)); | |
157 break; | |
158 | |
159 case GAIM_TYPE_ULONG: | |
160 gaim_value_set_ulong(new_value, gaim_value_get_ulong(value)); | |
161 break; | |
162 | |
163 case GAIM_TYPE_INT64: | |
164 gaim_value_set_int64(new_value, gaim_value_get_int64(value)); | |
165 break; | |
166 | |
167 case GAIM_TYPE_UINT64: | |
168 gaim_value_set_uint64(new_value, gaim_value_get_uint64(value)); | |
169 break; | |
170 | |
171 case GAIM_TYPE_STRING: | |
172 gaim_value_set_string(new_value, gaim_value_get_string(value)); | |
173 break; | |
174 | |
175 case GAIM_TYPE_OBJECT: | |
176 gaim_value_set_object(new_value, gaim_value_get_object(value)); | |
177 break; | |
178 | |
179 case GAIM_TYPE_POINTER: | |
180 gaim_value_set_pointer(new_value, gaim_value_get_pointer(value)); | |
181 break; | |
182 | |
183 case GAIM_TYPE_ENUM: | |
184 gaim_value_set_enum(new_value, gaim_value_get_enum(value)); | |
185 break; | |
186 | |
187 case GAIM_TYPE_BOXED: | |
188 gaim_value_set_boxed(new_value, gaim_value_get_boxed(value)); | |
189 break; | |
190 | |
191 default: | |
192 break; | |
193 } | |
194 | |
195 return new_value; | |
196 } | |
197 | |
100 GaimType | 198 GaimType |
101 gaim_value_get_type(const GaimValue *value) | 199 gaim_value_get_type(const GaimValue *value) |
102 { | 200 { |
103 g_return_val_if_fail(value != NULL, GAIM_TYPE_UNKNOWN); | 201 g_return_val_if_fail(value != NULL, GAIM_TYPE_UNKNOWN); |
104 | 202 |