1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
2 * GObject introspection: Type
3 *
4 * Copyright (C) 2005 Matthias Clasen
5 * Copyright (C) 2008,2009 Red Hat, Inc.
6 *
7 * SPDX-License-Identifier: LGPL-2.1-or-later
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the
21 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 * Boston, MA 02111-1307, USA.
23 */
24
25 #pragma once
26
27 #if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION)
28 #error "Only <girepository.h> can be included directly."
29 #endif
30
31 #include <girepository/gitypes.h>
32
33 G_BEGIN_DECLS
34
35 /**
36 * GI_IS_TYPE_INFO:
37 * @info: an info structure
38 *
39 * Checks if @info is a [alias@GIRepository.TypeInfo].
40 *
41 * Since: 2.80
42 */
43 #define GI_IS_TYPE_INFO(info) \
44 (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_TYPE)
45
46 /**
47 * GI_TYPE_TAG_IS_BASIC:
48 * @tag: a type tag
49 *
50 * Checks if @tag is a basic type.
51 *
52 * Since: 2.80
53 */
54 #define GI_TYPE_TAG_IS_BASIC(tag) ((tag) < GI_TYPE_TAG_ARRAY || (tag) == GI_TYPE_TAG_UNICHAR)
55
56 /**
57 * GI_TYPE_TAG_IS_NUMERIC:
58 * @tag: a type tag
59 *
60 * Checks if @tag is a numeric type. That is, integer or floating point.
61 *
62 * Since: 2.80
63 */
64 #define GI_TYPE_TAG_IS_NUMERIC(tag) ((tag) >= GI_TYPE_TAG_INT8 && (tag) <= GI_TYPE_TAG_DOUBLE)
65
66 /**
67 * GI_TYPE_TAG_IS_CONTAINER:
68 * @tag: a type tag
69 *
70 * Checks if @tag is a container type. That is, a type which may have a nonnull
71 * return from [method@GIRepository.TypeInfo.get_param_type].
72 *
73 * Since: 2.80
74 */
75 #define GI_TYPE_TAG_IS_CONTAINER(tag) ((tag) == GI_TYPE_TAG_ARRAY || \
76 ((tag) >= GI_TYPE_TAG_GLIST && (tag) <= GI_TYPE_TAG_GHASH))
77
78 GI_AVAILABLE_IN_ALL
79 const gchar* gi_type_tag_to_string (GITypeTag type);
80
81 GI_AVAILABLE_IN_ALL
82 const gchar* gi_info_type_to_string (GIInfoType type);
83
84
85 GI_AVAILABLE_IN_ALL
86 gboolean gi_type_info_is_pointer (GITypeInfo *info);
87
88 GI_AVAILABLE_IN_ALL
89 GITypeTag gi_type_info_get_tag (GITypeInfo *info);
90
91 GI_AVAILABLE_IN_ALL
92 GITypeInfo * gi_type_info_get_param_type (GITypeInfo *info,
93 guint n);
94
95 GI_AVAILABLE_IN_ALL
96 GIBaseInfo * gi_type_info_get_interface (GITypeInfo *info);
97
98 GI_AVAILABLE_IN_ALL
99 gint gi_type_info_get_array_length_index (GITypeInfo *info);
100
101 GI_AVAILABLE_IN_ALL
102 gssize gi_type_info_get_array_fixed_size (GITypeInfo *info);
103
104 GI_AVAILABLE_IN_ALL
105 gboolean gi_type_info_is_zero_terminated (GITypeInfo *info);
106
107 GI_AVAILABLE_IN_ALL
108 GIArrayType gi_type_info_get_array_type (GITypeInfo *info);
109
110 GI_AVAILABLE_IN_ALL
111 GITypeTag gi_type_info_get_storage_type (GITypeInfo *info);
112
113 GI_AVAILABLE_IN_ALL
114 void gi_type_info_argument_from_hash_pointer (GITypeInfo *info,
115 gpointer hash_pointer,
116 GIArgument *arg);
117
118 GI_AVAILABLE_IN_ALL
119 gpointer gi_type_info_hash_pointer_from_argument (GITypeInfo *info,
120 GIArgument *arg);
121
122 GI_AVAILABLE_IN_ALL
123 void gi_type_tag_argument_from_hash_pointer (GITypeTag storage_type,
124 gpointer hash_pointer,
125 GIArgument *arg);
126
127 GI_AVAILABLE_IN_ALL
128 gpointer gi_type_tag_hash_pointer_from_argument (GITypeTag storage_type,
129 GIArgument *arg);
130
131 G_END_DECLS