3 * Copyright (C) 2006 Trolltech AS. All rights reserved.
4 * Author: Thiago Macieira <thiago.macieira@trolltech.com>
6 * Licensed under the Academic Free License version 2.1
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 #ifndef QDBUSINTROSPECTION_H
25 #define QDBUSINTROSPECTION_H
27 #include <QtCore/qstring.h>
28 #include <QtCore/qlist.h>
29 #include <QtCore/qstringlist.h>
30 #include <QtCore/qmap.h>
31 #include <QtCore/qpair.h>
32 #include <QtCore/qshareddata.h>
33 #include "qdbusmacros.h"
35 class QDBUS_EXPORT QDBusIntrospection
38 // forward declarations
48 typedef QMap<QString, QString> Annotations;
49 typedef QList<Argument> Arguments;
50 typedef QMultiMap<QString, Method> Methods;
51 typedef QMultiMap<QString, Signal> Signals;
52 typedef QMap<QString, Property> Properties;
53 typedef QMap<QString, QSharedDataPointer<Interface> > Interfaces;
54 typedef QMap<QString, QSharedDataPointer<ObjectTree> > Objects;
64 inline bool operator==(const Argument& other) const
65 { return name == other.name && type == other.type; }
73 Annotations annotations;
75 inline bool operator==(const Method& other) const
76 { return name == other.name && annotations == other.annotations &&
77 inputArgs == other.inputArgs && outputArgs == other.outputArgs; }
84 Annotations annotations;
86 inline bool operator==(const Signal& other) const
87 { return name == other.name && annotations == other.annotations &&
88 outputArgs == other.outputArgs; }
93 enum Access { Read, Write, ReadWrite };
97 Annotations annotations;
99 inline bool operator==(const Property& other) const
100 { return access == other.access && name == other.name &&
101 annotations == other.annotations && type == other.type; }
104 struct Interface: public QSharedData
107 QString introspection;
109 Annotations annotations;
112 Properties properties;
114 inline bool operator==(const Interface &other) const
115 { return !name.isEmpty() && name == other.name; }
118 struct Object: public QSharedData
122 QString introspection;
124 QStringList interfaces;
125 QStringList childObjects;
128 struct ObjectTree: public Object
130 Interfaces interfaceData;
131 Objects childObjectData;
135 static Interface parseInterface(const QString &xml);
136 static Interfaces parseInterfaces(const QString &xml);
137 static Object parseObject(const QString &xml, const QString &service = QString(),
138 const QString &path = QString());
139 static ObjectTree parseObjectTree(const QString &xml,
140 const QString &service,
141 const QString &path);
144 QDBusIntrospection();