value.h
Go to the documentation of this file.
1
6 /* purple
7 *
8 * Purple is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
25 */
26 #ifndef _PURPLE_VALUE_H_
27 #define _PURPLE_VALUE_H_
28
29 #include <glib.h>
30
34 typedef enum
35 {
36 PURPLE_TYPE_UNKNOWN = 0,
37 PURPLE_TYPE_SUBTYPE,
38 PURPLE_TYPE_CHAR,
39 PURPLE_TYPE_UCHAR,
40 PURPLE_TYPE_BOOLEAN,
41 PURPLE_TYPE_SHORT,
42 PURPLE_TYPE_USHORT,
43 PURPLE_TYPE_INT,
44 PURPLE_TYPE_UINT,
45 PURPLE_TYPE_LONG,
46 PURPLE_TYPE_ULONG,
47 PURPLE_TYPE_INT64,
48 PURPLE_TYPE_UINT64,
49 PURPLE_TYPE_STRING,
50 PURPLE_TYPE_OBJECT,
51 PURPLE_TYPE_POINTER,
52 PURPLE_TYPE_ENUM,
53 PURPLE_TYPE_BOXED
55 } PurpleType;
56
57
61 typedef enum
62 {
63 PURPLE_SUBTYPE_UNKNOWN = 0,
64 PURPLE_SUBTYPE_ACCOUNT,
65 PURPLE_SUBTYPE_BLIST,
66 PURPLE_SUBTYPE_BLIST_BUDDY,
67 PURPLE_SUBTYPE_BLIST_GROUP,
68 PURPLE_SUBTYPE_BLIST_CHAT,
69 PURPLE_SUBTYPE_BUDDY_ICON,
70 PURPLE_SUBTYPE_CONNECTION,
71 PURPLE_SUBTYPE_CONVERSATION,
72 PURPLE_SUBTYPE_PLUGIN,
73 PURPLE_SUBTYPE_BLIST_NODE,
74 PURPLE_SUBTYPE_CIPHER,
75 PURPLE_SUBTYPE_STATUS,
76 PURPLE_SUBTYPE_LOG,
77 PURPLE_SUBTYPE_XFER,
78 PURPLE_SUBTYPE_SAVEDSTATUS,
79 PURPLE_SUBTYPE_XMLNODE,
80 PURPLE_SUBTYPE_USERINFO,
81 PURPLE_SUBTYPE_STORED_IMAGE,
82 PURPLE_SUBTYPE_CERTIFICATEPOOL,
83 PURPLE_SUBTYPE_CHATBUDDY
84 } PurpleSubType;
85
89 typedef struct
90 {
91 PurpleType type;
92 unsigned short flags;
93
94 union
95 {
96 char char_data;
97 unsigned char uchar_data;
98 gboolean boolean_data;
99 short short_data;
100 unsigned short ushort_data;
101 int int_data;
102 unsigned int uint_data;
103 long long_data;
104 unsigned long ulong_data;
105 gint64 int64_data;
106 guint64 uint64_data;
107 char *string_data;
108 void *object_data;
109 void *pointer_data;
110 int enum_data;
111 void *boxed_data;
112
113 } data;
114
115 union
116 {
117 unsigned int subtype;
118 char *specific_type;
119
120 } u;
121
122 } PurpleValue;
123
124 #ifdef __cplusplus
125 extern "C" {
126 #endif
127
147 PurpleValue *purple_value_new(PurpleType type, ...);
148
169 PurpleValue *purple_value_new_outgoing(PurpleType type, ...);
170
176 void purple_value_destroy(PurpleValue *value);
177
185 PurpleValue *purple_value_dup(const PurpleValue *value);
186
194 PurpleType purple_value_get_type(const PurpleValue *value);
195
206 unsigned int purple_value_get_subtype(const PurpleValue *value);
207
217 const char *purple_value_get_specific_type(const PurpleValue *value);
218
226 gboolean purple_value_is_outgoing(const PurpleValue *value);
227
234 void purple_value_set_char(PurpleValue *value, char data);
235
242 void purple_value_set_uchar(PurpleValue *value, unsigned char data);
243
250 void purple_value_set_boolean(PurpleValue *value, gboolean data);
251
258 void purple_value_set_short(PurpleValue *value, short data);
259
266 void purple_value_set_ushort(PurpleValue *value, unsigned short data);
267
274 void purple_value_set_int(PurpleValue *value, int data);
275
282 void purple_value_set_uint(PurpleValue *value, unsigned int data);
283
290 void purple_value_set_long(PurpleValue *value, long data);
291
298 void purple_value_set_ulong(PurpleValue *value, unsigned long data);
299
306 void purple_value_set_int64(PurpleValue *value, gint64 data);
307
314 void purple_value_set_uint64(PurpleValue *value, guint64 data);
315
322 void purple_value_set_string(PurpleValue *value, const char *data);
323
330 void purple_value_set_object(PurpleValue *value, void *data);
331
338 void purple_value_set_pointer(PurpleValue *value, void *data);
339
346 void purple_value_set_enum(PurpleValue *value, int data);
347
354 void purple_value_set_boxed(PurpleValue *value, void *data);
355
363 char purple_value_get_char(const PurpleValue *value);
364
372 unsigned char purple_value_get_uchar(const PurpleValue *value);
373
381 gboolean purple_value_get_boolean(const PurpleValue *value);
382
390 short purple_value_get_short(const PurpleValue *value);
391
399 unsigned short purple_value_get_ushort(const PurpleValue *value);
400
408 int purple_value_get_int(const PurpleValue *value);
409
417 unsigned int purple_value_get_uint(const PurpleValue *value);
418
426 long purple_value_get_long(const PurpleValue *value);
427
435 unsigned long purple_value_get_ulong(const PurpleValue *value);
436
444 gint64 purple_value_get_int64(const PurpleValue *value);
445
453 guint64 purple_value_get_uint64(const PurpleValue *value);
454
462 const char *purple_value_get_string(const PurpleValue *value);
463
471 void *purple_value_get_object(const PurpleValue *value);
472
480 void *purple_value_get_pointer(const PurpleValue *value);
481
489 int purple_value_get_enum(const PurpleValue *value);
490
498 void *purple_value_get_boxed(const PurpleValue *value);
499
500 #ifdef __cplusplus
501 }
502 #endif
503
504 #endif /* _PURPLE_VALUE_H_ */
purple_value_get_ushort
unsigned short purple_value_get_ushort(const PurpleValue *value)
Returns the value&#39;s unsigned short integer data.
purple_value_set_ulong
void purple_value_set_ulong(PurpleValue *value, unsigned long data)
Sets the value&#39;s unsigned long integer data.
PURPLE_TYPE_UINT
Unsigned integer.
Definition: value.h:44
purple_value_destroy
void purple_value_destroy(PurpleValue *value)
Destroys a PurpleValue.
PURPLE_TYPE_INT
Integer.
Definition: value.h:43
PURPLE_TYPE_SHORT
Short integer.
Definition: value.h:41
PURPLE_TYPE_UINT64
64-bit unsigned integer.
Definition: value.h:48
PURPLE_TYPE_USHORT
Unsigned short integer.
Definition: value.h:42
purple_value_get_short
short purple_value_get_short(const PurpleValue *value)
Returns the value&#39;s short integer data.
purple_value_get_pointer
void * purple_value_get_pointer(const PurpleValue *value)
Returns the value&#39;s pointer data.
purple_value_set_uint
void purple_value_set_uint(PurpleValue *value, unsigned int data)
Sets the value&#39;s unsigned integer data.
purple_value_set_pointer
void purple_value_set_pointer(PurpleValue *value, void *data)
Sets the value&#39;s pointer data.
purple_value_get_enum
int purple_value_get_enum(const PurpleValue *value)
Returns the value&#39;s enum data.
purple_value_set_object
void purple_value_set_object(PurpleValue *value, void *data)
Sets the value&#39;s object data.
purple_value_get_object
void * purple_value_get_object(const PurpleValue *value)
Returns the value&#39;s object data.
PURPLE_TYPE_OBJECT
Object pointer.
Definition: value.h:50
PURPLE_TYPE_STRING
String.
Definition: value.h:49
purple_value_get_uint
unsigned int purple_value_get_uint(const PurpleValue *value)
Returns the value&#39;s unsigned integer data.
purple_value_get_uint64
guint64 purple_value_get_uint64(const PurpleValue *value)
Returns the value&#39;s unsigned 64-bit integer data.
purple_value_set_boxed
void purple_value_set_boxed(PurpleValue *value, void *data)
Sets the value&#39;s boxed data.
purple_value_set_int64
void purple_value_set_int64(PurpleValue *value, gint64 data)
Sets the value&#39;s 64-bit integer data.
purple_value_get_boxed
void * purple_value_get_boxed(const PurpleValue *value)
Returns the value&#39;s boxed data.
purple_value_new
PurpleValue * purple_value_new(PurpleType type,...)
Creates a new PurpleValue.
PURPLE_TYPE_LONG
Long integer.
Definition: value.h:45
purple_value_get_string
const char * purple_value_get_string(const PurpleValue *value)
Returns the value&#39;s string data.
purple_value_set_short
void purple_value_set_short(PurpleValue *value, short data)
Sets the value&#39;s short integer data.
purple_value_set_uint64
void purple_value_set_uint64(PurpleValue *value, guint64 data)
Sets the value&#39;s unsigned 64-bit integer data.
PURPLE_TYPE_INT64
64-bit integer.
Definition: value.h:47
PURPLE_TYPE_ENUM
Enum.
Definition: value.h:52
PURPLE_TYPE_ULONG
Unsigned long integer.
Definition: value.h:46
purple_value_new_outgoing
PurpleValue * purple_value_new_outgoing(PurpleType type,...)
Creates a new outgoing PurpleValue.
purple_value_set_string
void purple_value_set_string(PurpleValue *value, const char *data)
Sets the value&#39;s string data.
purple_value_set_ushort
void purple_value_set_ushort(PurpleValue *value, unsigned short data)
Sets the value&#39;s unsigned short integer data.
PURPLE_TYPE_UCHAR
Unsigned character.
Definition: value.h:39
purple_value_get_int
int purple_value_get_int(const PurpleValue *value)
Returns the value&#39;s integer data.
purple_value_set_long
void purple_value_set_long(PurpleValue *value, long data)
Sets the value&#39;s long integer data.
purple_value_get_int64
gint64 purple_value_get_int64(const PurpleValue *value)
Returns the value&#39;s 64-bit integer data.
PURPLE_TYPE_BOXED
Boxed pointer with specific type.
Definition: value.h:53
purple_value_get_specific_type
const char * purple_value_get_specific_type(const PurpleValue *value)
Returns a value&#39;s specific type.
purple_value_get_subtype
unsigned int purple_value_get_subtype(const PurpleValue *value)
Returns a value&#39;s subtype.
PURPLE_TYPE_CHAR
Character.
Definition: value.h:38
purple_value_get_char
char purple_value_get_char(const PurpleValue *value)
Returns the value&#39;s character data.
purple_value_get_long
long purple_value_get_long(const PurpleValue *value)
Returns the value&#39;s long integer data.
purple_value_is_outgoing
gboolean purple_value_is_outgoing(const PurpleValue *value)
Returns whether or not the value is an outgoing value.
PURPLE_TYPE_SUBTYPE
Subtype.
Definition: value.h:37
PurpleValue
A wrapper for a type, subtype, and specific type of value.
Definition: value.h:89
PURPLE_TYPE_UNKNOWN
Unknown type.
Definition: value.h:36
PurpleSubType
PurpleSubType
Purple-specific subtype values.
Definition: value.h:61
purple_value_set_char
void purple_value_set_char(PurpleValue *value, char data)
Sets the value&#39;s character data.
purple_value_get_type
PurpleType purple_value_get_type(const PurpleValue *value)
Returns a value&#39;s type.
PURPLE_TYPE_POINTER
Generic pointer.
Definition: value.h:51
purple_value_dup
PurpleValue * purple_value_dup(const PurpleValue *value)
Duplicated a PurpleValue.
PurpleType
PurpleType
Specific value types.
Definition: value.h:34
purple_value_set_enum
void purple_value_set_enum(PurpleValue *value, int data)
Sets the value&#39;s enum data.
purple_value_get_uchar
unsigned char purple_value_get_uchar(const PurpleValue *value)
Returns the value&#39;s unsigned character data.
purple_value_get_boolean
gboolean purple_value_get_boolean(const PurpleValue *value)
Returns the value&#39;s boolean data.
purple_value_set_uchar
void purple_value_set_uchar(PurpleValue *value, unsigned char data)
Sets the value&#39;s unsigned character data.
purple_value_get_ulong
unsigned long purple_value_get_ulong(const PurpleValue *value)
Returns the value&#39;s unsigned long integer data.
purple_value_set_int
void purple_value_set_int(PurpleValue *value, int data)
Sets the value&#39;s integer data.
PURPLE_TYPE_BOOLEAN
Boolean.
Definition: value.h:40
purple_value_set_boolean
void purple_value_set_boolean(PurpleValue *value, gboolean data)
Sets the value&#39;s boolean data.