summaryrefslogtreecommitdiff
path: root/src/dbusidl.h
blob: 889751071f022077ca47ec5b029a07a852e35efc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
/* Copyright (C) 2009 David Zeuthen <zeuthen@gmail.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General
 * Public License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * Author: David Zeuthen <zeuthen@gmail.com>
 */

#include <glib.h>

#ifndef __DBUS_IDL_H
#define __DBUS_IDL_H

#ifndef DBUS_IDL_I_UNDERSTAND_THAT_API_IS_UNSTABLE
#error "The dbus-idl API is unstable You need to define DBUS_IDL_I_UNDERSTAND_THAT_API_IS_UNSTABLE to use this API."
#endif

G_BEGIN_DECLS

typedef enum
{
  DI_BASE_TYPE_ANNOTATION,
  DI_BASE_TYPE_TYPE,
  DI_BASE_TYPE_ARG,
  DI_BASE_TYPE_METHOD,
  DI_BASE_TYPE_SIGNAL,
  DI_BASE_TYPE_PROPERTY,
  DI_BASE_TYPE_INTERFACE,
  DI_BASE_TYPE_STRUCT_MEMBER,
  DI_BASE_TYPE_STRUCT,
  DI_BASE_TYPE_ENUM_MEMBER,
  DI_BASE_TYPE_ENUM,
  DI_BASE_TYPE_ERROR_MEMBER,
  DI_BASE_TYPE_ERROR_DOMAIN,
  DI_BASE_TYPE_COMMENT,
} DIBaseType;

typedef enum
{
  DI_PROPERTY_FLAGS_NONE     = 0,
  DI_PROPERTY_FLAGS_READABLE = (1<<0),
  DI_PROPERTY_FLAGS_WRITABLE = (1<<1),
  DI_PROPERTY_FLAGS_READWRITE = DI_PROPERTY_FLAGS_READABLE|DI_PROPERTY_FLAGS_WRITABLE
} DIPropertyFlags;

typedef enum
{
  DI_ARG_DIRECTION_NONE,
  DI_ARG_DIRECTION_IN,
  DI_ARG_DIRECTION_OUT,
} DIArgDirection;

/* Parser object */
typedef struct _DIParser               DIParser;

/* The base class for all objects */
typedef struct _DIBase                 DIBase;

/* These objects are all based on DIBase */
typedef struct _DIAnnotation           DIAnnotation;
typedef struct _DIType                 DIType;
typedef struct _DIArg                  DIArg;
typedef struct _DIMethod               DIMethod;
typedef struct _DISignal               DISignal;
typedef struct _DIProperty             DIProperty;
typedef struct _DIInterface            DIInterface;
typedef struct _DIStructMember         DIStructMember;
typedef struct _DIStruct               DIStruct;
typedef struct _DIEnumMember           DIEnumMember;
typedef struct _DIEnum                 DIEnum;
typedef struct _DIErrorMember          DIErrorMember;
typedef struct _DIErrorDomain          DIErrorDomain;
typedef struct _DIComment              DIComment;

/* ---------------------------------------------------------------------------------------------------- */

const gchar *di_annotation_get_name  (DIAnnotation *annotation);
const gchar *di_annotation_get_value (DIAnnotation *annotation);

/* ---------------------------------------------------------------------------------------------------- */

DIBaseType    di_base_get_type                 (DIBase      *base);
const gchar  *di_base_get_decl_path            (DIBase      *base);
guint         di_base_get_decl_lineno          (DIBase      *base);
const gchar  *di_base_get_doc                  (DIBase      *base);
const gchar  *di_base_get_doc_brief            (DIBase      *base);
GList        *di_base_get_annotations          (DIBase      *base);
DIAnnotation *di_base_get_annotation           (DIBase      *base,
                                                const gchar *name);
const gchar  *di_base_get_annotation_value     (DIBase      *base,
                                                const gchar *name);
DIBase       *di_base_get_parent               (DIBase      *base);
const gchar  *di_base_get_namespace            (DIBase      *base);

/* ---------------------------------------------------------------------------------------------------- */

const gchar *di_type_get_name                 (DIType  *type);
const gchar *di_type_get_signature            (DIType  *type);
const gchar *di_type_get_complete_signature   (DIType  *type);
gint         di_type_get_typecode             (DIType  *type);
GList       *di_type_get_inner_types          (DIType  *type);

/* ---------------------------------------------------------------------------------------------------- */

const gchar    *di_arg_get_name        (DIArg  *arg);
DIType         *di_arg_get_type        (DIArg  *arg);
DIArgDirection  di_arg_get_direction   (DIArg  *arg);

/* ---------------------------------------------------------------------------------------------------- */

const gchar *di_method_get_name                 (DIMethod  *method);
GList       *di_method_get_args                 (DIMethod  *method);
const gchar *di_method_get_in_signature         (DIMethod  *method);
const gchar *di_method_get_out_signature        (DIMethod  *method);

/* ---------------------------------------------------------------------------------------------------- */

const gchar *di_signal_get_name                 (DISignal  *signal);
GList       *di_signal_get_args                 (DISignal  *signal);
const gchar *di_signal_get_signature            (DISignal  *signal);

/* ---------------------------------------------------------------------------------------------------- */

const gchar    *di_property_get_name                 (DIProperty  *property);
DIType         *di_property_get_type                 (DIProperty  *property);
const gchar    *di_property_get_signature            (DIProperty  *property);
DIPropertyFlags di_property_get_flags                (DIProperty  *property);

/* ---------------------------------------------------------------------------------------------------- */

const gchar *di_interface_get_name                 (DIInterface  *interface);
GList       *di_interface_get_methods              (DIInterface  *interface);
GList       *di_interface_get_signals              (DIInterface  *interface);
GList       *di_interface_get_properties           (DIInterface  *interface);
DIMethod    *di_interface_lookup_method            (DIInterface  *interface,
                                                    const gchar  *name);
DISignal    *di_interface_lookup_signal            (DIInterface  *interface,
                                                    const gchar  *name);
DIProperty  *di_interface_lookup_property          (DIInterface  *interface,
                                                    const gchar  *name);

/* ---------------------------------------------------------------------------------------------------- */

const gchar *di_struct_member_get_name        (DIStructMember  *struct_member);
DIType      *di_struct_member_get_type        (DIStructMember  *struct_member);

/* ---------------------------------------------------------------------------------------------------- */

const gchar *di_struct_get_name                 (DIStruct  *struct_);
GList       *di_struct_get_members              (DIStruct  *struct_);

/* ---------------------------------------------------------------------------------------------------- */

const gchar *di_enum_member_get_name                 (DIEnumMember  *enum_member);
guint        di_enum_member_get_value                (DIEnumMember  *enum_member);
gboolean     di_enum_member_get_unset                (DIEnumMember  *enum_member);

/* ---------------------------------------------------------------------------------------------------- */

const gchar *di_enum_get_name                 (DIEnum  *enum_);
GList       *di_enum_get_members              (DIEnum  *enum_);

/* ---------------------------------------------------------------------------------------------------- */

const gchar *di_error_member_get_name                 (DIErrorMember  *error_member);

/* ---------------------------------------------------------------------------------------------------- */

const gchar *di_error_domain_get_name                 (DIErrorDomain  *error_domain);
GList       *di_error_domain_get_members              (DIErrorDomain  *error_domain);

/* ---------------------------------------------------------------------------------------------------- */

const gchar  *di_comment_get_raw                    (DIComment   *comment);
gboolean      di_comment_get_is_multiline           (DIComment   *comment);
DIBase       *di_comment_get_base                   (DIComment   *comment);
const gchar  *di_comment_get_brief                  (DIComment   *comment);
const gchar  *di_comment_get_text                   (DIComment   *comment);
GList        *di_comment_get_tags                   (DIComment   *comment);
const gchar  *di_comment_get_tag_value              (DIComment   *comment,
                                                     const gchar *tag);

/* ---------------------------------------------------------------------------------------------------- */

DIParser      *di_parser_new                       (gchar       **files);
GList         *di_parser_get_interfaces            (DIParser  *parser);
GList         *di_parser_get_structs               (DIParser  *parser);
GList         *di_parser_get_enums                 (DIParser  *parser);
GList         *di_parser_get_error_domains         (DIParser  *parser);
DIInterface   *di_parser_lookup_interface          (DIParser  *parser,
                                                    const gchar  *name);
DIStruct      *di_parser_lookup_struct             (DIParser  *parser,
                                                    const gchar  *name);
DIEnum        *di_parser_lookup_enum               (DIParser  *parser,
                                                    const gchar  *name);
DIErrorDomain *di_parser_lookup_error_domain       (DIParser  *parser,
                                                    const gchar  *name);
GList         *di_parser_get_comments              (DIParser     *parser);
GList         *di_parser_get_warnings              (DIParser     *parser);
GList         *di_parser_get_errors                (DIParser     *parser);
void           di_parser_free                      (DIParser     *parser);

/* ---------------------------------------------------------------------------------------------------- */

void di_interface_print    (DIInterface   *interface, guint indent);
void di_struct_print       (DIStruct      *struct_, guint indent);
void di_enum_print         (DIEnum        *enum_, guint indent);
void di_error_domain_print (DIErrorDomain *error_domain, guint indent);

G_END_DECLS

#endif /* __DBUS_IDL_H */