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