Imported Upstream version 1.1.0
[gammaray-debian.git] / metaobjectrepository.h
blobc30d68596414663ff9f9c2199bc7ec0ea1badd2c
1 /*
2 metaobjectrepository.h
4 This file is part of GammaRay, the Qt application inspection and
5 manipulation tool.
7 Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
8 Author: Volker Krause <volker.krause@kdab.com>
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation, either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #ifndef GAMMARAY_METAOBJECTREPOSITORY_H
25 #define GAMMARAY_METAOBJECTREPOSITORY_H
27 #include <QHash>
29 class QString;
31 namespace GammaRay {
33 class MetaObject;
35 /**
36 * Repository of compile-time introspection information for stuff
37 * not covered by the Qt meta object system.
39 class MetaObjectRepository
41 public:
42 ~MetaObjectRepository();
44 /** Singleton accessor. */
45 static MetaObjectRepository *instance();
47 /**
48 * Adds object type information to the repository.
50 void addMetaObject(MetaObject *mo);
52 /**
53 * Returns the introspection information for the type with the given name.
55 MetaObject *metaObject(const QString &typeName) const;
57 /**
58 * Returns whether a meta object is known for the given type name.
60 bool hasMetaObject(const QString &typeName) const;
62 protected:
63 MetaObjectRepository();
65 private:
66 void initBuiltInTypes();
67 void initQObjectTypes();
68 void initGraphicsViewTypes();
70 private:
71 QHash<QString, MetaObject*> m_metaObjects;
76 #endif // GAMMARAY_METAOBJECTREPOSITORY_H