gvalue.h

Go to the documentation of this file.
00001 /* GObject - GLib Type, Object, Parameter and Signal Library
00002  * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc.
00003  * Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General
00016  * Public License along with this library; if not, write to the
00017  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
00018  * Boston, MA 02111-1307, USA.
00019  *
00020  * gvalue.h: generic GValue functions
00021  */
00022 #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
00023 #error "Only <glib-object.h> can be included directly."
00024 #endif
00025 
00026 #ifndef __G_VALUE_H__
00027 #define __G_VALUE_H__
00028 
00029 #include <_ansi.h>
00030 #include        <gobject/gtype.h>
00031 
00032 G_BEGIN_DECLS
00033 
00034 /* --- type macros --- */
00035 #define G_TYPE_IS_VALUE(type)           (g_type_check_is_value_type (type))
00036 #define G_IS_VALUE(value)               (G_TYPE_CHECK_VALUE (value))
00037 #define G_VALUE_TYPE(value)             (((GValue*) (value))->g_type)
00038 #define G_VALUE_TYPE_NAME(value)        (g_type_name (G_VALUE_TYPE (value)))
00039 #define G_VALUE_HOLDS(value,type)       (G_TYPE_CHECK_VALUE_TYPE ((value), (type)))
00040 
00041 
00042 /* --- typedefs & structures --- */
00043 typedef void (*GValueTransform) (const GValue *src_value,
00044                                  GValue       *dest_value);
00045 struct _GValue
00046 {
00047   /*< private >*/
00048   GType         g_type;
00049 
00050   /* public for GTypeValueTable methods */
00051   union {
00052     gint        v_int;
00053     guint       v_uint;
00054     glong       v_long;
00055     gulong      v_ulong;
00056     gint64      v_int64;
00057     guint64     v_uint64;
00058     gfloat      v_float;
00059     gdouble     v_double;
00060     gpointer    v_pointer;
00061   } data[2];
00062 };
00063 
00064 
00065 /* --- prototypes --- */
00066 IMPORT_C GValue*         g_value_init           (GValue       *value,
00067                                          GType         g_type);
00068 IMPORT_C void            g_value_copy           (const GValue *src_value,
00069                                          GValue       *dest_value);
00070 IMPORT_C GValue*         g_value_reset          (GValue       *value);
00071 IMPORT_C void            g_value_unset          (GValue       *value);
00072 IMPORT_C void           g_value_set_instance    (GValue       *value,
00073                                          gpointer      instance);
00074 
00075 
00076 /* --- private --- */
00077 IMPORT_C gboolean       g_value_fits_pointer    (const GValue *value);
00078 IMPORT_C gpointer       g_value_peek_pointer    (const GValue *value);
00079 
00080 
00081 /* --- implementation details --- */
00082 IMPORT_C gboolean g_value_type_compatible       (GType           src_type,
00083                                          GType           dest_type);
00084 IMPORT_C gboolean g_value_type_transformable    (GType           src_type,
00085                                          GType           dest_type);
00086 IMPORT_C gboolean g_value_transform             (const GValue   *src_value,
00087                                          GValue         *dest_value);
00088 IMPORT_C void   g_value_register_transform_func (GType           src_type,
00089                                          GType           dest_type,
00090                                          GValueTransform transform_func);
00091 #define G_VALUE_NOCOPY_CONTENTS         (1 << 27)
00092 
00093 
00094 G_END_DECLS
00095 
00096 #endif /* __G_VALUE_H__ */

Copyright © Nokia Corporation 2001-2008
Back to top