1 gvalue.h |
1 /* GObject - GLib Type, Object, Parameter and Signal Library |
|
2 * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc. |
|
3 * Portions copyright (c) 2006 Nokia Corporation. All rights reserved. |
|
4 * |
|
5 * This library is free software; you can redistribute it and/or |
|
6 * modify it under the terms of the GNU Lesser General Public |
|
7 * License as published by the Free Software Foundation; either |
|
8 * version 2 of the License, or (at your option) any later version. |
|
9 * |
|
10 * This library is distributed in the hope that it will be useful, |
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 * Lesser General Public License for more details. |
|
14 * |
|
15 * You should have received a copy of the GNU Lesser General |
|
16 * Public License along with this library; if not, write to the |
|
17 * Free Software Foundation, Inc., 59 Temple Place, Suite 330, |
|
18 * Boston, MA 02111-1307, USA. |
|
19 * |
|
20 * gvalue.h: generic GValue functions |
|
21 */ |
|
22 #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) |
|
23 #error "Only <glib-object.h> can be included directly." |
|
24 #endif |
|
25 |
|
26 #ifndef __G_VALUE_H__ |
|
27 #define __G_VALUE_H__ |
|
28 |
|
29 #include <_ansi.h> |
|
30 #include <gobject/gtype.h> |
|
31 |
|
32 G_BEGIN_DECLS |
|
33 |
|
34 /* --- type macros --- */ |
|
35 #define G_TYPE_IS_VALUE(type) (g_type_check_is_value_type (type)) |
|
36 #define G_IS_VALUE(value) (G_TYPE_CHECK_VALUE (value)) |
|
37 #define G_VALUE_TYPE(value) (((GValue*) (value))->g_type) |
|
38 #define G_VALUE_TYPE_NAME(value) (g_type_name (G_VALUE_TYPE (value))) |
|
39 #define G_VALUE_HOLDS(value,type) (G_TYPE_CHECK_VALUE_TYPE ((value), (type))) |
|
40 |
|
41 |
|
42 /* --- typedefs & structures --- */ |
|
43 typedef void (*GValueTransform) (const GValue *src_value, |
|
44 GValue *dest_value); |
|
45 struct _GValue |
|
46 { |
|
47 /*< private >*/ |
|
48 GType g_type; |
|
49 |
|
50 /* public for GTypeValueTable methods */ |
|
51 union { |
|
52 gint v_int; |
|
53 guint v_uint; |
|
54 glong v_long; |
|
55 gulong v_ulong; |
|
56 gint64 v_int64; |
|
57 guint64 v_uint64; |
|
58 gfloat v_float; |
|
59 gdouble v_double; |
|
60 gpointer v_pointer; |
|
61 } data[2]; |
|
62 }; |
|
63 |
|
64 |
|
65 /* --- prototypes --- */ |
|
66 IMPORT_C GValue* g_value_init (GValue *value, |
|
67 GType g_type); |
|
68 IMPORT_C void g_value_copy (const GValue *src_value, |
|
69 GValue *dest_value); |
|
70 IMPORT_C GValue* g_value_reset (GValue *value); |
|
71 IMPORT_C void g_value_unset (GValue *value); |
|
72 IMPORT_C void g_value_set_instance (GValue *value, |
|
73 gpointer instance); |
|
74 |
|
75 |
|
76 /* --- private --- */ |
|
77 IMPORT_C gboolean g_value_fits_pointer (const GValue *value); |
|
78 IMPORT_C gpointer g_value_peek_pointer (const GValue *value); |
|
79 |
|
80 |
|
81 /* --- implementation details --- */ |
|
82 IMPORT_C gboolean g_value_type_compatible (GType src_type, |
|
83 GType dest_type); |
|
84 IMPORT_C gboolean g_value_type_transformable (GType src_type, |
|
85 GType dest_type); |
|
86 IMPORT_C gboolean g_value_transform (const GValue *src_value, |
|
87 GValue *dest_value); |
|
88 IMPORT_C void g_value_register_transform_func (GType src_type, |
|
89 GType dest_type, |
|
90 GValueTransform transform_func); |
|
91 #define G_VALUE_NOCOPY_CONTENTS (1 << 27) |
|
92 |
|
93 |
|
94 G_END_DECLS |
|
95 |
|
96 #endif /* __G_VALUE_H__ */ |