add reserved fundamental ids for gtk types (for transition time). added
[platform/upstream/glib.git] / gobject / gvalue.h
1 /* GObject - GLib Type, Object, Parameter and Signal Library
2  * Copyright (C) 1997, 1998, 1999, 2000 Tim Janik and Red Hat, Inc.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General
15  * Public License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
17  * Boston, MA 02111-1307, USA.
18  *
19  * gvalue.h: generic GValue functions
20  */
21 #ifndef __G_VALUE_H__
22 #define __G_VALUE_H__
23
24
25 #include        <gobject/gparam.h>
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif /* __cplusplus */
30
31
32 /* --- type macros --- */
33 #define G_TYPE_IS_VALUE(type)           (G_TYPE_FUNDAMENTAL (type) == G_TYPE_PARAM)
34 #define G_IS_VALUE(value)               (G_TYPE_CHECK_CLASS_TYPE ((value), G_TYPE_PARAM))
35 #define G_VALUE_TYPE(value)             (G_TYPE_FROM_CLASS (value))
36 #define G_VALUE_TYPE_NAME(value)        (g_type_name (G_VALUE_TYPE (value)))
37
38
39 /* --- typedefs & structures --- */
40 /* typedef struct _GValue           GValue; */
41 struct _GValue
42 {
43   GType           g_type;       /* param value type */
44
45   union {
46     gint        v_int;
47     guint       v_uint;
48     glong       v_long;
49     gulong      v_ulong;
50     gfloat      v_float;
51     gdouble     v_double;
52     gpointer    v_pointer;
53   } data[4];
54 };
55
56
57 /* --- prototypes --- */
58 void            g_value_init            (GValue       *value,
59                                          GType         g_type);
60 void            g_value_init_default    (GValue       *value,
61                                          GParamSpec   *pspec);
62 gboolean        g_value_validate        (GValue       *value,
63                                          GParamSpec   *pspec);
64 gboolean        g_value_defaults        (const GValue *value,
65                                          GParamSpec   *pspec);
66 void            g_value_set_default     (GValue       *value,
67                                          GParamSpec   *pspec);
68 gint            g_values_cmp            (const GValue *value1,
69                                          const GValue *value2,
70                                          GParamSpec   *pspec);
71 void            g_value_copy            (const GValue *src_value,
72                                          GValue       *dest_value);
73 gboolean        g_value_convert         (const GValue *src_value,
74                                          GValue       *dest_value);
75 gboolean        g_values_exchange       (GValue       *value1,
76                                          GValue       *value2);
77 void            g_value_reset           (GValue       *value);
78 void            g_value_unset           (GValue       *value);
79
80
81 /* --- implementation bits --- */
82 gboolean g_value_types_exchangable      (GType         value_type1,
83                                          GType         value_type2);
84 void     g_value_register_exchange_func (GType         value_type1,
85                                          GType         value_type2,
86                                          GValueExchange func);
87
88 #ifdef __cplusplus
89 }
90 #endif /* __cplusplus */
91
92 #endif /* __G_VALUE_H__ */