1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/Frameworks/libpurple.framework/Versions/0.6.2/Headers/value.h Fri Aug 21 13:25:11 2009 -0700
1.3 @@ -0,0 +1,503 @@
1.4 +/**
1.5 + * @file value.h Value wrapper API
1.6 + * @ingroup core
1.7 + */
1.8 +
1.9 +/* purple
1.10 + *
1.11 + * Purple is the legal property of its developers, whose names are too numerous
1.12 + * to list here. Please refer to the COPYRIGHT file distributed with this
1.13 + * source distribution.
1.14 + *
1.15 + * This program is free software; you can redistribute it and/or modify
1.16 + * it under the terms of the GNU General Public License as published by
1.17 + * the Free Software Foundation; either version 2 of the License, or
1.18 + * (at your option) any later version.
1.19 + *
1.20 + * This program is distributed in the hope that it will be useful,
1.21 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.22 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.23 + * GNU General Public License for more details.
1.24 + *
1.25 + * You should have received a copy of the GNU General Public License
1.26 + * along with this program; if not, write to the Free Software
1.27 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
1.28 + */
1.29 +#ifndef _PURPLE_VALUE_H_
1.30 +#define _PURPLE_VALUE_H_
1.31 +
1.32 +#include <glib.h>
1.33 +
1.34 +/**
1.35 + * Specific value types.
1.36 + */
1.37 +typedef enum
1.38 +{
1.39 + PURPLE_TYPE_UNKNOWN = 0, /**< Unknown type. */
1.40 + PURPLE_TYPE_SUBTYPE, /**< Subtype. */
1.41 + PURPLE_TYPE_CHAR, /**< Character. */
1.42 + PURPLE_TYPE_UCHAR, /**< Unsigned character. */
1.43 + PURPLE_TYPE_BOOLEAN, /**< Boolean. */
1.44 + PURPLE_TYPE_SHORT, /**< Short integer. */
1.45 + PURPLE_TYPE_USHORT, /**< Unsigned short integer. */
1.46 + PURPLE_TYPE_INT, /**< Integer. */
1.47 + PURPLE_TYPE_UINT, /**< Unsigned integer. */
1.48 + PURPLE_TYPE_LONG, /**< Long integer. */
1.49 + PURPLE_TYPE_ULONG, /**< Unsigned long integer. */
1.50 + PURPLE_TYPE_INT64, /**< 64-bit integer. */
1.51 + PURPLE_TYPE_UINT64, /**< 64-bit unsigned integer. */
1.52 + PURPLE_TYPE_STRING, /**< String. */
1.53 + PURPLE_TYPE_OBJECT, /**< Object pointer. */
1.54 + PURPLE_TYPE_POINTER, /**< Generic pointer. */
1.55 + PURPLE_TYPE_ENUM, /**< Enum. */
1.56 + PURPLE_TYPE_BOXED /**< Boxed pointer with specific type. */
1.57 +
1.58 +} PurpleType;
1.59 +
1.60 +
1.61 +/**
1.62 + * Purple-specific subtype values.
1.63 + */
1.64 +typedef enum
1.65 +{
1.66 + PURPLE_SUBTYPE_UNKNOWN = 0,
1.67 + PURPLE_SUBTYPE_ACCOUNT,
1.68 + PURPLE_SUBTYPE_BLIST,
1.69 + PURPLE_SUBTYPE_BLIST_BUDDY,
1.70 + PURPLE_SUBTYPE_BLIST_GROUP,
1.71 + PURPLE_SUBTYPE_BLIST_CHAT,
1.72 + PURPLE_SUBTYPE_BUDDY_ICON,
1.73 + PURPLE_SUBTYPE_CONNECTION,
1.74 + PURPLE_SUBTYPE_CONVERSATION,
1.75 + PURPLE_SUBTYPE_PLUGIN,
1.76 + PURPLE_SUBTYPE_BLIST_NODE,
1.77 + PURPLE_SUBTYPE_CIPHER,
1.78 + PURPLE_SUBTYPE_STATUS,
1.79 + PURPLE_SUBTYPE_LOG,
1.80 + PURPLE_SUBTYPE_XFER,
1.81 + PURPLE_SUBTYPE_SAVEDSTATUS,
1.82 + PURPLE_SUBTYPE_XMLNODE,
1.83 + PURPLE_SUBTYPE_USERINFO,
1.84 + PURPLE_SUBTYPE_STORED_IMAGE,
1.85 + PURPLE_SUBTYPE_CERTIFICATEPOOL
1.86 +} PurpleSubType;
1.87 +
1.88 +/**
1.89 + * A wrapper for a type, subtype, and specific type of value.
1.90 + */
1.91 +typedef struct
1.92 +{
1.93 + PurpleType type;
1.94 + unsigned short flags;
1.95 +
1.96 + union
1.97 + {
1.98 + char char_data;
1.99 + unsigned char uchar_data;
1.100 + gboolean boolean_data;
1.101 + short short_data;
1.102 + unsigned short ushort_data;
1.103 + int int_data;
1.104 + unsigned int uint_data;
1.105 + long long_data;
1.106 + unsigned long ulong_data;
1.107 + gint64 int64_data;
1.108 + guint64 uint64_data;
1.109 + char *string_data;
1.110 + void *object_data;
1.111 + void *pointer_data;
1.112 + int enum_data;
1.113 + void *boxed_data;
1.114 +
1.115 + } data;
1.116 +
1.117 + union
1.118 + {
1.119 + unsigned int subtype;
1.120 + char *specific_type;
1.121 +
1.122 + } u;
1.123 +
1.124 +} PurpleValue;
1.125 +
1.126 +#ifdef __cplusplus
1.127 +extern "C" {
1.128 +#endif
1.129 +
1.130 +/**
1.131 + * Creates a new PurpleValue.
1.132 + *
1.133 + * This function takes a type and, depending on that type, a sub-type
1.134 + * or specific type.
1.135 + *
1.136 + * If @a type is PURPLE_TYPE_BOXED, the next parameter must be a
1.137 + * string representing the specific type.
1.138 + *
1.139 + * If @a type is PURPLE_TYPE_SUBTYPE, the next parameter must be a
1.140 + * integer or enum representing the sub-type.
1.141 + *
1.142 + * If the subtype or specific type is not set when required, random
1.143 + * errors may occur. You have been warned.
1.144 + *
1.145 + * @param type The type.
1.146 + *
1.147 + * @return The new value.
1.148 + */
1.149 +PurpleValue *purple_value_new(PurpleType type, ...);
1.150 +
1.151 +/**
1.152 + * Creates a new outgoing PurpleValue. If a value is an "outgoing" value
1.153 + * it means the value can be modified by plugins and scripts.
1.154 + *
1.155 + * This function takes a type and, depending on that type, a sub-type
1.156 + * or specific type.
1.157 + *
1.158 + * If @a type is PURPLE_TYPE_BOXED, the next parameter must be a
1.159 + * string representing the specific type.
1.160 + *
1.161 + * If @a type is PURPLE_TYPE_SUBTYPE, the next parameter must be a
1.162 + * integer or enum representing the sub-type.
1.163 + *
1.164 + * If the sub-type or specific type is not set when required, random
1.165 + * errors may occur. You have been warned.
1.166 + *
1.167 + * @param type The type.
1.168 + *
1.169 + * @return The new value.
1.170 + */
1.171 +PurpleValue *purple_value_new_outgoing(PurpleType type, ...);
1.172 +
1.173 +/**
1.174 + * Destroys a PurpleValue.
1.175 + *
1.176 + * @param value The value to destroy.
1.177 + */
1.178 +void purple_value_destroy(PurpleValue *value);
1.179 +
1.180 +/**
1.181 + * Duplicated a PurpleValue.
1.182 + *
1.183 + * @param value The value to duplicate.
1.184 + *
1.185 + * @return The duplicate value.
1.186 + */
1.187 +PurpleValue *purple_value_dup(const PurpleValue *value);
1.188 +
1.189 +/**
1.190 + * Returns a value's type.
1.191 + *
1.192 + * @param value The value whose type you want.
1.193 + *
1.194 + * @return The value's type.
1.195 + */
1.196 +PurpleType purple_value_get_type(const PurpleValue *value);
1.197 +
1.198 +/**
1.199 + * Returns a value's subtype.
1.200 + *
1.201 + * If the value's type is not PURPLE_TYPE_SUBTYPE, this will return 0.
1.202 + * Subtypes should never have a subtype of 0.
1.203 + *
1.204 + * @param value The value whose subtype you want.
1.205 + *
1.206 + * @return The value's subtype, or 0 if @a type is not PURPLE_TYPE_SUBTYPE.
1.207 + */
1.208 +unsigned int purple_value_get_subtype(const PurpleValue *value);
1.209 +
1.210 +/**
1.211 + * Returns a value's specific type.
1.212 + *
1.213 + * If the value's type is not PURPLE_TYPE_BOXED, this will return @c NULL.
1.214 + *
1.215 + * @param value The value whose specific type you want.
1.216 + *
1.217 + * @return The value's specific type, or @a NULL if not PURPLE_TYPE_BOXED.
1.218 + */
1.219 +const char *purple_value_get_specific_type(const PurpleValue *value);
1.220 +
1.221 +/**
1.222 + * Returns whether or not the value is an outgoing value.
1.223 + *
1.224 + * @param value The value.
1.225 + *
1.226 + * @return TRUE if the value is outgoing, or FALSE otherwise.
1.227 + */
1.228 +gboolean purple_value_is_outgoing(const PurpleValue *value);
1.229 +
1.230 +/**
1.231 + * Sets the value's character data.
1.232 + *
1.233 + * @param value The value.
1.234 + * @param data The character data.
1.235 + */
1.236 +void purple_value_set_char(PurpleValue *value, char data);
1.237 +
1.238 +/**
1.239 + * Sets the value's unsigned character data.
1.240 + *
1.241 + * @param value The value.
1.242 + * @param data The unsigned character data.
1.243 + */
1.244 +void purple_value_set_uchar(PurpleValue *value, unsigned char data);
1.245 +
1.246 +/**
1.247 + * Sets the value's boolean data.
1.248 + *
1.249 + * @param value The value.
1.250 + * @param data The boolean data.
1.251 + */
1.252 +void purple_value_set_boolean(PurpleValue *value, gboolean data);
1.253 +
1.254 +/**
1.255 + * Sets the value's short integer data.
1.256 + *
1.257 + * @param value The value.
1.258 + * @param data The short integer data.
1.259 + */
1.260 +void purple_value_set_short(PurpleValue *value, short data);
1.261 +
1.262 +/**
1.263 + * Sets the value's unsigned short integer data.
1.264 + *
1.265 + * @param value The value.
1.266 + * @param data The unsigned short integer data.
1.267 + */
1.268 +void purple_value_set_ushort(PurpleValue *value, unsigned short data);
1.269 +
1.270 +/**
1.271 + * Sets the value's integer data.
1.272 + *
1.273 + * @param value The value.
1.274 + * @param data The integer data.
1.275 + */
1.276 +void purple_value_set_int(PurpleValue *value, int data);
1.277 +
1.278 +/**
1.279 + * Sets the value's unsigned integer data.
1.280 + *
1.281 + * @param value The value.
1.282 + * @param data The unsigned integer data.
1.283 + */
1.284 +void purple_value_set_uint(PurpleValue *value, unsigned int data);
1.285 +
1.286 +/**
1.287 + * Sets the value's long integer data.
1.288 + *
1.289 + * @param value The value.
1.290 + * @param data The long integer data.
1.291 + */
1.292 +void purple_value_set_long(PurpleValue *value, long data);
1.293 +
1.294 +/**
1.295 + * Sets the value's unsigned long integer data.
1.296 + *
1.297 + * @param value The value.
1.298 + * @param data The unsigned long integer data.
1.299 + */
1.300 +void purple_value_set_ulong(PurpleValue *value, unsigned long data);
1.301 +
1.302 +/**
1.303 + * Sets the value's 64-bit integer data.
1.304 + *
1.305 + * @param value The value.
1.306 + * @param data The 64-bit integer data.
1.307 + */
1.308 +void purple_value_set_int64(PurpleValue *value, gint64 data);
1.309 +
1.310 +/**
1.311 + * Sets the value's unsigned 64-bit integer data.
1.312 + *
1.313 + * @param value The value.
1.314 + * @param data The unsigned 64-bit integer data.
1.315 + */
1.316 +void purple_value_set_uint64(PurpleValue *value, guint64 data);
1.317 +
1.318 +/**
1.319 + * Sets the value's string data.
1.320 + *
1.321 + * @param value The value.
1.322 + * @param data The string data.
1.323 + */
1.324 +void purple_value_set_string(PurpleValue *value, const char *data);
1.325 +
1.326 +/**
1.327 + * Sets the value's object data.
1.328 + *
1.329 + * @param value The value.
1.330 + * @param data The object data.
1.331 + */
1.332 +void purple_value_set_object(PurpleValue *value, void *data);
1.333 +
1.334 +/**
1.335 + * Sets the value's pointer data.
1.336 + *
1.337 + * @param value The value.
1.338 + * @param data The pointer data.
1.339 + */
1.340 +void purple_value_set_pointer(PurpleValue *value, void *data);
1.341 +
1.342 +/**
1.343 + * Sets the value's enum data.
1.344 + *
1.345 + * @param value The value.
1.346 + * @param data The enum data.
1.347 + */
1.348 +void purple_value_set_enum(PurpleValue *value, int data);
1.349 +
1.350 +/**
1.351 + * Sets the value's boxed data.
1.352 + *
1.353 + * @param value The value.
1.354 + * @param data The boxed data.
1.355 + */
1.356 +void purple_value_set_boxed(PurpleValue *value, void *data);
1.357 +
1.358 +/**
1.359 + * Returns the value's character data.
1.360 + *
1.361 + * @param value The value.
1.362 + *
1.363 + * @return The character data.
1.364 + */
1.365 +char purple_value_get_char(const PurpleValue *value);
1.366 +
1.367 +/**
1.368 + * Returns the value's unsigned character data.
1.369 + *
1.370 + * @param value The value.
1.371 + *
1.372 + * @return The unsigned character data.
1.373 + */
1.374 +unsigned char purple_value_get_uchar(const PurpleValue *value);
1.375 +
1.376 +/**
1.377 + * Returns the value's boolean data.
1.378 + *
1.379 + * @param value The value.
1.380 + *
1.381 + * @return The boolean data.
1.382 + */
1.383 +gboolean purple_value_get_boolean(const PurpleValue *value);
1.384 +
1.385 +/**
1.386 + * Returns the value's short integer data.
1.387 + *
1.388 + * @param value The value.
1.389 + *
1.390 + * @return The short integer data.
1.391 + */
1.392 +short purple_value_get_short(const PurpleValue *value);
1.393 +
1.394 +/**
1.395 + * Returns the value's unsigned short integer data.
1.396 + *
1.397 + * @param value The value.
1.398 + *
1.399 + * @return The unsigned short integer data.
1.400 + */
1.401 +unsigned short purple_value_get_ushort(const PurpleValue *value);
1.402 +
1.403 +/**
1.404 + * Returns the value's integer data.
1.405 + *
1.406 + * @param value The value.
1.407 + *
1.408 + * @return The integer data.
1.409 + */
1.410 +int purple_value_get_int(const PurpleValue *value);
1.411 +
1.412 +/**
1.413 + * Returns the value's unsigned integer data.
1.414 + *
1.415 + * @param value The value.
1.416 + *
1.417 + * @return The unsigned integer data.
1.418 + */
1.419 +unsigned int purple_value_get_uint(const PurpleValue *value);
1.420 +
1.421 +/**
1.422 + * Returns the value's long integer data.
1.423 + *
1.424 + * @param value The value.
1.425 + *
1.426 + * @return The long integer data.
1.427 + */
1.428 +long purple_value_get_long(const PurpleValue *value);
1.429 +
1.430 +/**
1.431 + * Returns the value's unsigned long integer data.
1.432 + *
1.433 + * @param value The value.
1.434 + *
1.435 + * @return The unsigned long integer data.
1.436 + */
1.437 +unsigned long purple_value_get_ulong(const PurpleValue *value);
1.438 +
1.439 +/**
1.440 + * Returns the value's 64-bit integer data.
1.441 + *
1.442 + * @param value The value.
1.443 + *
1.444 + * @return The 64-bit integer data.
1.445 + */
1.446 +gint64 purple_value_get_int64(const PurpleValue *value);
1.447 +
1.448 +/**
1.449 + * Returns the value's unsigned 64-bit integer data.
1.450 + *
1.451 + * @param value The value.
1.452 + *
1.453 + * @return The unsigned 64-bit integer data.
1.454 + */
1.455 +guint64 purple_value_get_uint64(const PurpleValue *value);
1.456 +
1.457 +/**
1.458 + * Returns the value's string data.
1.459 + *
1.460 + * @param value The value.
1.461 + *
1.462 + * @return The string data.
1.463 + */
1.464 +const char *purple_value_get_string(const PurpleValue *value);
1.465 +
1.466 +/**
1.467 + * Returns the value's object data.
1.468 + *
1.469 + * @param value The value.
1.470 + *
1.471 + * @return The object data.
1.472 + */
1.473 +void *purple_value_get_object(const PurpleValue *value);
1.474 +
1.475 +/**
1.476 + * Returns the value's pointer data.
1.477 + *
1.478 + * @param value The value.
1.479 + *
1.480 + * @return The pointer data.
1.481 + */
1.482 +void *purple_value_get_pointer(const PurpleValue *value);
1.483 +
1.484 +/**
1.485 + * Returns the value's enum data.
1.486 + *
1.487 + * @param value The value.
1.488 + *
1.489 + * @return The enum data.
1.490 + */
1.491 +int purple_value_get_enum(const PurpleValue *value);
1.492 +
1.493 +/**
1.494 + * Returns the value's boxed data.
1.495 + *
1.496 + * @param value The value.
1.497 + *
1.498 + * @return The boxed data.
1.499 + */
1.500 +void *purple_value_get_boxed(const PurpleValue *value);
1.501 +
1.502 +#ifdef __cplusplus
1.503 +}
1.504 +#endif
1.505 +
1.506 +#endif /* _PURPLE_VALUE_H_ */