]> vaikene.ee Git - evaf/blob - src/plugins/Test/factory.cpp
e3cba8be677313e42eb31525f0905937dd411663
[evaf] / src / plugins / Test / factory.cpp
1 /**
2 * @file plugins/Test/factory.cpp
3 * @brief eVaf test plugin factory
4 * @author Enar Vaikene
5 *
6 * Copyright (c) 2011 Enar Vaikene
7 *
8 * This file is part of the eVaf C++ cross-platform application development framework.
9 *
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.
15 *
16 * Alternatively, this file may be used in accordance with the Commercial License
17 * Agreement provided with the Software.
18 */
19
20 #include "factory.h"
21 #include "test.h"
22
23 #include <Common/iLogger>
24
25 #include <QtCore>
26
27 using namespace eVaf::Test;
28
29 VER_EXPORT_VERSION_INFO()
30
31
32 //-------------------------------------------------------------------
33
34 Factory::Factory()
35 : Plugins::iPluginFactory()
36 , mTest(0)
37 {
38 setObjectName(QString("%1-Factory").arg(VER_MODULE_NAME_STR));
39
40 EVAF_INFO("%s created", qPrintable(objectName()));
41 }
42
43 Factory::~Factory()
44 {
45 if (mTest)
46 delete mTest;
47
48 EVAF_INFO("%s destroyed", qPrintable(objectName()));
49 }
50
51 QObject * Factory::create(QString const & name)
52 {
53 if (name == "Test") {
54 if (mTest == 0)
55 mTest = new Internal::TestPlugin;
56 return mTest;
57 }
58 else
59 return 0;
60 }