value.h
Go to the documentation of this file.
/* purple
*
* Purple is the legal property of its developers, whose names are too numerous
* to list here. Please refer to the COPYRIGHT file distributed with this
* source distribution.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
#ifndef _PURPLE_VALUE_H_
#define _PURPLE_VALUE_H_
#include <glib.h>
typedef enum
{
PURPLE_TYPE_UNKNOWN = 0,
PURPLE_TYPE_SUBTYPE,
PURPLE_TYPE_CHAR,
PURPLE_TYPE_UCHAR,
PURPLE_TYPE_BOOLEAN,
PURPLE_TYPE_SHORT,
PURPLE_TYPE_USHORT,
PURPLE_TYPE_INT,
PURPLE_TYPE_UINT,
PURPLE_TYPE_LONG,
PURPLE_TYPE_ULONG,
PURPLE_TYPE_INT64,
PURPLE_TYPE_UINT64,
PURPLE_TYPE_STRING,
PURPLE_TYPE_OBJECT,
PURPLE_TYPE_POINTER,
PURPLE_TYPE_ENUM,
PURPLE_TYPE_BOXED
} PurpleType;
typedef enum
{
PURPLE_SUBTYPE_UNKNOWN = 0,
PURPLE_SUBTYPE_ACCOUNT,
PURPLE_SUBTYPE_BLIST,
PURPLE_SUBTYPE_BLIST_BUDDY,
PURPLE_SUBTYPE_BLIST_GROUP,
PURPLE_SUBTYPE_BLIST_CHAT,
PURPLE_SUBTYPE_BUDDY_ICON,
PURPLE_SUBTYPE_CONNECTION,
PURPLE_SUBTYPE_CONVERSATION,
PURPLE_SUBTYPE_PLUGIN,
PURPLE_SUBTYPE_BLIST_NODE,
PURPLE_SUBTYPE_CIPHER,
PURPLE_SUBTYPE_STATUS,
PURPLE_SUBTYPE_LOG,
PURPLE_SUBTYPE_XFER,
PURPLE_SUBTYPE_SAVEDSTATUS,
PURPLE_SUBTYPE_XMLNODE,
PURPLE_SUBTYPE_USERINFO,
PURPLE_SUBTYPE_STORED_IMAGE,
PURPLE_SUBTYPE_CERTIFICATEPOOL,
PURPLE_SUBTYPE_CHATBUDDY
} PurpleSubType;
typedef struct
{
PurpleType type;
unsigned short flags;
union
{
char char_data;
unsigned char uchar_data;
gboolean boolean_data;
short short_data;
unsigned short ushort_data;
int int_data;
unsigned int uint_data;
long long_data;
unsigned long ulong_data;
gint64 int64_data;
guint64 uint64_data;
char *string_data;
void *object_data;
void *pointer_data;
int enum_data;
void *boxed_data;
} data;
union
{
unsigned int subtype;
char *specific_type;
} u;
} PurpleValue;
#ifdef __cplusplus
extern "C" {
#endif
PurpleValue *purple_value_new(PurpleType type, ...);
PurpleValue *purple_value_new_outgoing(PurpleType type, ...);
void purple_value_destroy(PurpleValue *value);
PurpleValue *purple_value_dup(const PurpleValue *value);
PurpleType purple_value_get_type(const PurpleValue *value);
unsigned int purple_value_get_subtype(const PurpleValue *value);
const char *purple_value_get_specific_type(const PurpleValue *value);
gboolean purple_value_is_outgoing(const PurpleValue *value);
void purple_value_set_char(PurpleValue *value, char data);
void purple_value_set_uchar(PurpleValue *value, unsigned char data);
void purple_value_set_boolean(PurpleValue *value, gboolean data);
void purple_value_set_short(PurpleValue *value, short data);
void purple_value_set_ushort(PurpleValue *value, unsigned short data);
void purple_value_set_int(PurpleValue *value, int data);
void purple_value_set_uint(PurpleValue *value, unsigned int data);
void purple_value_set_long(PurpleValue *value, long data);
void purple_value_set_ulong(PurpleValue *value, unsigned long data);
void purple_value_set_int64(PurpleValue *value, gint64 data);
void purple_value_set_uint64(PurpleValue *value, guint64 data);
void purple_value_set_string(PurpleValue *value, const char *data);
void purple_value_set_object(PurpleValue *value, void *data);
void purple_value_set_pointer(PurpleValue *value, void *data);
void purple_value_set_enum(PurpleValue *value, int data);
void purple_value_set_boxed(PurpleValue *value, void *data);
char purple_value_get_char(const PurpleValue *value);
unsigned char purple_value_get_uchar(const PurpleValue *value);
gboolean purple_value_get_boolean(const PurpleValue *value);
short purple_value_get_short(const PurpleValue *value);
unsigned short purple_value_get_ushort(const PurpleValue *value);
int purple_value_get_int(const PurpleValue *value);
unsigned int purple_value_get_uint(const PurpleValue *value);
long purple_value_get_long(const PurpleValue *value);
unsigned long purple_value_get_ulong(const PurpleValue *value);
gint64 purple_value_get_int64(const PurpleValue *value);
guint64 purple_value_get_uint64(const PurpleValue *value);
const char *purple_value_get_string(const PurpleValue *value);
void *purple_value_get_object(const PurpleValue *value);
void *purple_value_get_pointer(const PurpleValue *value);
int purple_value_get_enum(const PurpleValue *value);
void *purple_value_get_boxed(const PurpleValue *value);
#ifdef __cplusplus
}
#endif
#endif /* _PURPLE_VALUE_H_ */
PurpleValue
A wrapper for a type, subtype, and specific type of value.
Definition: value.h:90
purple_value_set_ulong
void purple_value_set_ulong(PurpleValue *value, unsigned long data)
Sets the value's unsigned long integer data.
purple_value_dup
PurpleValue * purple_value_dup(const PurpleValue *value)
Duplicated a PurpleValue.
purple_value_get_uint64
guint64 purple_value_get_uint64(const PurpleValue *value)
Returns the value's unsigned 64-bit integer data.
purple_value_get_type
PurpleType purple_value_get_type(const PurpleValue *value)
Returns a value's type.
purple_value_set_enum
void purple_value_set_enum(PurpleValue *value, int data)
Sets the value's enum data.
purple_value_get_int64
gint64 purple_value_get_int64(const PurpleValue *value)
Returns the value's 64-bit integer data.
purple_value_get_int
int purple_value_get_int(const PurpleValue *value)
Returns the value's integer data.
purple_value_set_pointer
void purple_value_set_pointer(PurpleValue *value, void *data)
Sets the value's pointer data.
purple_value_destroy
void purple_value_destroy(PurpleValue *value)
Destroys a PurpleValue.
purple_value_get_ulong
unsigned long purple_value_get_ulong(const PurpleValue *value)
Returns the value's unsigned long integer data.
purple_value_set_boxed
void purple_value_set_boxed(PurpleValue *value, void *data)
Sets the value's boxed data.
purple_value_set_int
void purple_value_set_int(PurpleValue *value, int data)
Sets the value's integer data.
purple_value_set_char
void purple_value_set_char(PurpleValue *value, char data)
Sets the value's character data.
PurpleSubType
PurpleSubType
Purple-specific subtype values.
Definition: value.h:62
purple_value_set_uint
void purple_value_set_uint(PurpleValue *value, unsigned int data)
Sets the value's unsigned integer data.
purple_value_new_outgoing
PurpleValue * purple_value_new_outgoing(PurpleType type,...)
Creates a new outgoing PurpleValue.
purple_value_get_long
long purple_value_get_long(const PurpleValue *value)
Returns the value's long integer data.
purple_value_set_object
void purple_value_set_object(PurpleValue *value, void *data)
Sets the value's object data.
purple_value_get_uchar
unsigned char purple_value_get_uchar(const PurpleValue *value)
Returns the value's unsigned character data.
purple_value_get_boolean
gboolean purple_value_get_boolean(const PurpleValue *value)
Returns the value's boolean data.
PurpleType
PurpleType
Specific value types.
Definition: value.h:35
PURPLE_TYPE_UINT64
@ PURPLE_TYPE_UINT64
64-bit unsigned integer.
Definition: value.h:48
PURPLE_TYPE_SUBTYPE
@ PURPLE_TYPE_SUBTYPE
Subtype.
Definition: value.h:37
PURPLE_TYPE_UNKNOWN
@ PURPLE_TYPE_UNKNOWN
Unknown type.
Definition: value.h:36
PURPLE_TYPE_UCHAR
@ PURPLE_TYPE_UCHAR
Unsigned character.
Definition: value.h:39
PURPLE_TYPE_INT64
@ PURPLE_TYPE_INT64
64-bit integer.
Definition: value.h:47
PURPLE_TYPE_LONG
@ PURPLE_TYPE_LONG
Long integer.
Definition: value.h:45
PURPLE_TYPE_OBJECT
@ PURPLE_TYPE_OBJECT
Object pointer.
Definition: value.h:50
PURPLE_TYPE_ULONG
@ PURPLE_TYPE_ULONG
Unsigned long integer.
Definition: value.h:46
PURPLE_TYPE_CHAR
@ PURPLE_TYPE_CHAR
Character.
Definition: value.h:38
PURPLE_TYPE_UINT
@ PURPLE_TYPE_UINT
Unsigned integer.
Definition: value.h:44
PURPLE_TYPE_BOXED
@ PURPLE_TYPE_BOXED
Boxed pointer with specific type.
Definition: value.h:53
PURPLE_TYPE_USHORT
@ PURPLE_TYPE_USHORT
Unsigned short integer.
Definition: value.h:42
PURPLE_TYPE_STRING
@ PURPLE_TYPE_STRING
String.
Definition: value.h:49
PURPLE_TYPE_ENUM
@ PURPLE_TYPE_ENUM
Enum.
Definition: value.h:52
PURPLE_TYPE_SHORT
@ PURPLE_TYPE_SHORT
Short integer.
Definition: value.h:41
PURPLE_TYPE_BOOLEAN
@ PURPLE_TYPE_BOOLEAN
Boolean.
Definition: value.h:40
PURPLE_TYPE_INT
@ PURPLE_TYPE_INT
Integer.
Definition: value.h:43
PURPLE_TYPE_POINTER
@ PURPLE_TYPE_POINTER
Generic pointer.
Definition: value.h:51
purple_value_set_uint64
void purple_value_set_uint64(PurpleValue *value, guint64 data)
Sets the value's unsigned 64-bit integer data.
purple_value_get_specific_type
const char * purple_value_get_specific_type(const PurpleValue *value)
Returns a value's specific type.
purple_value_set_int64
void purple_value_set_int64(PurpleValue *value, gint64 data)
Sets the value's 64-bit integer data.
purple_value_get_string
const char * purple_value_get_string(const PurpleValue *value)
Returns the value's string data.
purple_value_is_outgoing
gboolean purple_value_is_outgoing(const PurpleValue *value)
Returns whether or not the value is an outgoing value.
purple_value_new
PurpleValue * purple_value_new(PurpleType type,...)
Creates a new PurpleValue.
purple_value_set_short
void purple_value_set_short(PurpleValue *value, short data)
Sets the value's short integer data.
purple_value_set_long
void purple_value_set_long(PurpleValue *value, long data)
Sets the value's long integer data.
purple_value_get_short
short purple_value_get_short(const PurpleValue *value)
Returns the value's short integer data.
purple_value_get_object
void * purple_value_get_object(const PurpleValue *value)
Returns the value's object data.
purple_value_get_boxed
void * purple_value_get_boxed(const PurpleValue *value)
Returns the value's boxed data.
purple_value_get_subtype
unsigned int purple_value_get_subtype(const PurpleValue *value)
Returns a value's subtype.
purple_value_get_uint
unsigned int purple_value_get_uint(const PurpleValue *value)
Returns the value's unsigned integer data.
purple_value_set_string
void purple_value_set_string(PurpleValue *value, const char *data)
Sets the value's string data.
purple_value_get_char
char purple_value_get_char(const PurpleValue *value)
Returns the value's character data.
purple_value_get_pointer
void * purple_value_get_pointer(const PurpleValue *value)
Returns the value's pointer data.
purple_value_get_enum
int purple_value_get_enum(const PurpleValue *value)
Returns the value's enum data.
purple_value_set_boolean
void purple_value_set_boolean(PurpleValue *value, gboolean data)
Sets the value's boolean data.
purple_value_get_ushort
unsigned short purple_value_get_ushort(const PurpleValue *value)
Returns the value's unsigned short integer data.
purple_value_set_uchar
void purple_value_set_uchar(PurpleValue *value, unsigned char data)
Sets the value's unsigned character data.
purple_value_set_ushort
void purple_value_set_ushort(PurpleValue *value, unsigned short data)
Sets the value's unsigned short integer data.