williamr@2: /* GObject - GLib Type, Object, Parameter and Signal Library williamr@2: * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc. williamr@2: * Portions copyright (c) 2006 Nokia Corporation. All rights reserved. williamr@2: * williamr@2: * This library is free software; you can redistribute it and/or williamr@2: * modify it under the terms of the GNU Lesser General Public williamr@2: * License as published by the Free Software Foundation; either williamr@2: * version 2 of the License, or (at your option) any later version. williamr@2: * williamr@2: * This library is distributed in the hope that it will be useful, williamr@2: * but WITHOUT ANY WARRANTY; without even the implied warranty of williamr@2: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU williamr@2: * Lesser General Public License for more details. williamr@2: * williamr@2: * You should have received a copy of the GNU Lesser General williamr@2: * Public License along with this library; if not, write to the williamr@2: * Free Software Foundation, Inc., 59 Temple Place, Suite 330, williamr@2: * Boston, MA 02111-1307, USA. williamr@2: * williamr@2: * gvalue.h: generic GValue functions williamr@2: */ williamr@2: #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) williamr@2: #error "Only <glib-object.h> can be included directly." williamr@2: #endif williamr@2: williamr@2: #ifndef __G_VALUE_H__ williamr@2: #define __G_VALUE_H__ williamr@2: williamr@2: #include <_ansi.h> williamr@2: #include <gobject/gtype.h> williamr@2: williamr@2: G_BEGIN_DECLS williamr@2: williamr@2: /* --- type macros --- */ williamr@2: #define G_TYPE_IS_VALUE(type) (g_type_check_is_value_type (type)) williamr@2: #define G_IS_VALUE(value) (G_TYPE_CHECK_VALUE (value)) williamr@2: #define G_VALUE_TYPE(value) (((GValue*) (value))->g_type) williamr@2: #define G_VALUE_TYPE_NAME(value) (g_type_name (G_VALUE_TYPE (value))) williamr@2: #define G_VALUE_HOLDS(value,type) (G_TYPE_CHECK_VALUE_TYPE ((value), (type))) williamr@2: williamr@2: williamr@2: /* --- typedefs & structures --- */ williamr@2: typedef void (*GValueTransform) (const GValue *src_value, williamr@2: GValue *dest_value); williamr@2: struct _GValue williamr@2: { williamr@2: /*< private >*/ williamr@2: GType g_type; williamr@2: williamr@2: /* public for GTypeValueTable methods */ williamr@2: union { williamr@2: gint v_int; williamr@2: guint v_uint; williamr@2: glong v_long; williamr@2: gulong v_ulong; williamr@2: gint64 v_int64; williamr@2: guint64 v_uint64; williamr@2: gfloat v_float; williamr@2: gdouble v_double; williamr@2: gpointer v_pointer; williamr@2: } data[2]; williamr@2: }; williamr@2: williamr@2: williamr@2: /* --- prototypes --- */ williamr@2: IMPORT_C GValue* g_value_init (GValue *value, williamr@2: GType g_type); williamr@2: IMPORT_C void g_value_copy (const GValue *src_value, williamr@2: GValue *dest_value); williamr@2: IMPORT_C GValue* g_value_reset (GValue *value); williamr@2: IMPORT_C void g_value_unset (GValue *value); williamr@2: IMPORT_C void g_value_set_instance (GValue *value, williamr@2: gpointer instance); williamr@2: williamr@2: williamr@2: /* --- private --- */ williamr@2: IMPORT_C gboolean g_value_fits_pointer (const GValue *value); williamr@2: IMPORT_C gpointer g_value_peek_pointer (const GValue *value); williamr@2: williamr@2: williamr@2: /* --- implementation details --- */ williamr@2: IMPORT_C gboolean g_value_type_compatible (GType src_type, williamr@2: GType dest_type); williamr@2: IMPORT_C gboolean g_value_type_transformable (GType src_type, williamr@2: GType dest_type); williamr@2: IMPORT_C gboolean g_value_transform (const GValue *src_value, williamr@2: GValue *dest_value); williamr@2: IMPORT_C void g_value_register_transform_func (GType src_type, williamr@2: GType dest_type, williamr@2: GValueTransform transform_func); williamr@2: #define G_VALUE_NOCOPY_CONTENTS (1 << 27) williamr@2: williamr@2: williamr@2: G_END_DECLS williamr@2: williamr@2: #endif /* __G_VALUE_H__ */