00001
00025 #ifndef _GAIM_VALUE_H_
00026 #define _GAIM_VALUE_H_
00027
00028 #include <glib.h>
00029
00033 typedef enum
00034 {
00035 GAIM_TYPE_UNKNOWN = 0,
00036 GAIM_TYPE_SUBTYPE,
00037 GAIM_TYPE_CHAR,
00038 GAIM_TYPE_UCHAR,
00039 GAIM_TYPE_BOOLEAN,
00040 GAIM_TYPE_SHORT,
00041 GAIM_TYPE_USHORT,
00042 GAIM_TYPE_INT,
00043 GAIM_TYPE_UINT,
00044 GAIM_TYPE_LONG,
00045 GAIM_TYPE_ULONG,
00046 GAIM_TYPE_INT64,
00047 GAIM_TYPE_UINT64,
00048 GAIM_TYPE_STRING,
00049 GAIM_TYPE_OBJECT,
00050 GAIM_TYPE_POINTER,
00051 GAIM_TYPE_ENUM,
00052 GAIM_TYPE_BOXED
00054 } GaimType;
00055
00059 typedef enum
00060 {
00061 GAIM_SUBTYPE_UNKNOWN = 0,
00062 GAIM_SUBTYPE_ACCOUNT,
00063 GAIM_SUBTYPE_BLIST,
00064 GAIM_SUBTYPE_BLIST_BUDDY,
00065 GAIM_SUBTYPE_BLIST_GROUP,
00066 GAIM_SUBTYPE_BLIST_CHAT,
00067 GAIM_SUBTYPE_CONNECTION,
00068 GAIM_SUBTYPE_CONVERSATION,
00069 GAIM_SUBTYPE_CONV_WINDOW,
00070 GAIM_SUBTYPE_PLUGIN
00071
00072 } GaimSubType;
00073
00077 typedef struct
00078 {
00079 GaimType type;
00080 unsigned short flags;
00081
00082 union
00083 {
00084 char char_data;
00085 unsigned char uchar_data;
00086 gboolean boolean_data;
00087 short short_data;
00088 unsigned short ushort_data;
00089 int int_data;
00090 unsigned int uint_data;
00091 long long_data;
00092 unsigned long ulong_data;
00093 gint64 int64_data;
00094 guint64 uint64_data;
00095 char *string_data;
00096 void *object_data;
00097 void *pointer_data;
00098 int enum_data;
00099 void *boxed_data;
00100
00101 } data;
00102
00103 union
00104 {
00105 unsigned int subtype;
00106 char *specific_type;
00107
00108 } u;
00109
00110 } GaimValue;
00111
00112 #ifdef __cplusplus
00113 extern "C" {
00114 #endif
00115
00135 GaimValue *gaim_value_new(GaimType type, ...);
00136
00156 GaimValue *gaim_value_new_outgoing(GaimType type, ...);
00157
00163 void gaim_value_destroy(GaimValue *value);
00164
00170 GaimType gaim_value_get_type(const GaimValue *value);
00171
00180 unsigned int gaim_value_get_subtype(const GaimValue *value);
00181
00189 const char *gaim_value_get_specific_type(const GaimValue *value);
00190
00198 gboolean gaim_value_is_outgoing(const GaimValue *value);
00199
00206 void gaim_value_set_char(GaimValue *value, char data);
00207
00214 void gaim_value_set_uchar(GaimValue *value, unsigned char data);
00215
00222 void gaim_value_set_boolean(GaimValue *value, gboolean data);
00223
00230 void gaim_value_set_short(GaimValue *value, short data);
00231
00238 void gaim_value_set_ushort(GaimValue *value, unsigned short data);
00239
00246 void gaim_value_set_int(GaimValue *value, int data);
00247
00254 void gaim_value_set_uint(GaimValue *value, unsigned int data);
00255
00262 void gaim_value_set_long(GaimValue *value, long data);
00263
00270 void gaim_value_set_ulong(GaimValue *value, unsigned long data);
00271
00278 void gaim_value_set_int64(GaimValue *value, gint64 data);
00279
00286 void gaim_value_set_uint64(GaimValue *value, guint64 data);
00287
00294 void gaim_value_set_string(GaimValue *value, const char *data);
00295
00302 void gaim_value_set_object(GaimValue *value, void *data);
00303
00310 void gaim_value_set_pointer(GaimValue *value, void *data);
00311
00318 void gaim_value_set_enum(GaimValue *value, int data);
00319
00326 void gaim_value_set_boxed(GaimValue *value, void *data);
00327
00335 char gaim_value_get_char(const GaimValue *value);
00336
00344 unsigned char gaim_value_get_uchar(const GaimValue *value);
00345
00353 gboolean gaim_value_get_boolean(const GaimValue *value);
00354
00362 short gaim_value_get_short(const GaimValue *value);
00363
00371 unsigned short gaim_value_get_ushort(const GaimValue *value);
00372
00380 int gaim_value_get_int(const GaimValue *value);
00381
00389 unsigned int gaim_value_get_uint(const GaimValue *value);
00390
00398 long gaim_value_get_long(const GaimValue *value);
00399
00407 unsigned long gaim_value_get_ulong(const GaimValue *value);
00408
00416 gint64 gaim_value_get_int64(const GaimValue *value);
00417
00425 guint64 gaim_value_get_uint64(const GaimValue *value);
00426
00434 const char *gaim_value_get_string(const GaimValue *value);
00435
00443 void *gaim_value_get_object(const GaimValue *value);
00444
00452 void *gaim_value_get_pointer(const GaimValue *value);
00453
00461 int gaim_value_get_enum(const GaimValue *value);
00462
00470 void *gaim_value_get_boxed(const GaimValue *value);
00471
00472 #ifdef __cplusplus
00473 }
00474 #endif
00475
00476 #endif