1 | /* GObject - GLib Type, Object, Parameter and Signal Library |
---|
2 | * Copyright (C) 1997-1999, 2000-2001 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 | #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) |
---|
22 | #error "Only <glib-object.h> can be included directly." |
---|
23 | #endif |
---|
24 | |
---|
25 | #ifndef __G_VALUE_H__ |
---|
26 | #define __G_VALUE_H__ |
---|
27 | |
---|
28 | #include <gobject/gtype.h> |
---|
29 | |
---|
30 | G_BEGIN_DECLS |
---|
31 | |
---|
32 | /* --- type macros --- */ |
---|
33 | #define G_TYPE_IS_VALUE(type) (g_type_check_is_value_type (type)) |
---|
34 | #define G_IS_VALUE(value) (G_TYPE_CHECK_VALUE (value)) |
---|
35 | #define G_VALUE_TYPE(value) (((GValue*) (value))->g_type) |
---|
36 | #define G_VALUE_TYPE_NAME(value) (g_type_name (G_VALUE_TYPE (value))) |
---|
37 | #define G_VALUE_HOLDS(value,type) (G_TYPE_CHECK_VALUE_TYPE ((value), (type))) |
---|
38 | |
---|
39 | |
---|
40 | /* --- typedefs & structures --- */ |
---|
41 | typedef void (*GValueTransform) (const GValue *src_value, |
---|
42 | GValue *dest_value); |
---|
43 | struct _GValue |
---|
44 | { |
---|
45 | /*< private >*/ |
---|
46 | GType g_type; |
---|
47 | |
---|
48 | /* public for GTypeValueTable methods */ |
---|
49 | union { |
---|
50 | gint v_int; |
---|
51 | guint v_uint; |
---|
52 | glong v_long; |
---|
53 | gulong v_ulong; |
---|
54 | gint64 v_int64; |
---|
55 | guint64 v_uint64; |
---|
56 | gfloat v_float; |
---|
57 | gdouble v_double; |
---|
58 | gpointer v_pointer; |
---|
59 | } data[2]; |
---|
60 | }; |
---|
61 | |
---|
62 | |
---|
63 | /* --- prototypes --- */ |
---|
64 | GValue* g_value_init (GValue *value, |
---|
65 | GType g_type); |
---|
66 | void g_value_copy (const GValue *src_value, |
---|
67 | GValue *dest_value); |
---|
68 | GValue* g_value_reset (GValue *value); |
---|
69 | void g_value_unset (GValue *value); |
---|
70 | void g_value_set_instance (GValue *value, |
---|
71 | gpointer instance); |
---|
72 | |
---|
73 | |
---|
74 | /* --- private --- */ |
---|
75 | gboolean g_value_fits_pointer (const GValue *value); |
---|
76 | gpointer g_value_peek_pointer (const GValue *value); |
---|
77 | |
---|
78 | |
---|
79 | /* --- implementation details --- */ |
---|
80 | gboolean g_value_type_compatible (GType src_type, |
---|
81 | GType dest_type); |
---|
82 | gboolean g_value_type_transformable (GType src_type, |
---|
83 | GType dest_type); |
---|
84 | gboolean g_value_transform (const GValue *src_value, |
---|
85 | GValue *dest_value); |
---|
86 | void g_value_register_transform_func (GType src_type, |
---|
87 | GType dest_type, |
---|
88 | GValueTransform transform_func); |
---|
89 | #define G_VALUE_NOCOPY_CONTENTS (1 << 27) |
---|
90 | |
---|
91 | |
---|
92 | G_END_DECLS |
---|
93 | |
---|
94 | #endif /* __G_VALUE_H__ */ |
---|