]>
vaikene.ee Git - evaf/blob - registry.h
3df7d58ac62526fae07086080ad984de3d082aed
2 * @file Common/registry.h
3 * @brief Common registry implementation
6 * Copyright (c) 2011-2019 Enar Vaikene
8 * This file is part of the eVaf C++ cross-platform application development framework.
10 * This file can be used under the terms of the GNU General Public License
11 * version 3.0 as published by the Free Software Foundation and appearing in
12 * the file LICENSE included in the packaging of this file. Please review the
13 * the following information to ensure the GNU General Public License version
14 * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
16 * Alternatively, this file may be used in accordance with the Commercial License
17 * Agreement provided with the Software.
20 #ifndef __COMMON_REGISTRY_H
21 #define __COMMON_REGISTRY_H
23 #include "iregistry.h"
34 * iRegistry interface implementation.
36 * This class implements the global registry for interfaces. Interfaces are stored in a QHash container
37 * and quarded with QWeakPointer.
39 class Registry
: public iRegistry
53 virtual bool registerInterface(QString
const & name
, QObject
* obj
);
55 virtual QObject
* queryInterface(QString
const & name
) const;
60 /// All the registered interfaces
61 typedef QHash
<QString
, QObject
*> Interfaces
;
62 Interfaces mInterfaces
;
67 /// Interface object destroyed
68 /// We need to remove the interface from the list of registered interfaces
69 void interfaceDestroyed(QObject
* obj
= nullptr);
73 } // namespace eVaf::Common::Internal
74 } // namespace eVaf::Common