X-Git-Url: https://vaikene.ee/gitweb/gitweb.cgi?a=blobdiff_plain;f=src%2Fplugins%2FTest%2Ffactory.cpp;fp=src%2Fplugins%2FTest%2Ffactory.cpp;h=feb433ff6432f9d6ff9b55d0a3acc762c5d421fb;hb=9536caf853c74774aa308854a6c1caaf32435438;hp=0000000000000000000000000000000000000000;hpb=ad3c375c68b46edcb823ff3eb2dc12647da1db19;p=evaf diff --git a/src/plugins/Test/factory.cpp b/src/plugins/Test/factory.cpp new file mode 100644 index 0000000..feb433f --- /dev/null +++ b/src/plugins/Test/factory.cpp @@ -0,0 +1,62 @@ +/** + * @file plugins/Test/factory.cpp + * @brief eVaf test plugin factory + * @author Enar Vaikene + * + * Copyright (c) 2011 Enar Vaikene + * + * This file is part of the eVaf C++ cross-platform application development framework. + * + * This file can be used under the terms of the GNU General Public License + * version 3.0 as published by the Free Software Foundation and appearing in + * the file LICENSE included in the packaging of this file. Please review the + * the following information to ensure the GNU General Public License version + * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html. + * + * Alternatively, this file may be used in accordance with the Commercial License + * Agreement provided with the Software. + */ + +#include "factory.h" +#include "test.h" +#include "version.h" + +#include + +#include + +using namespace eVaf::Test; + +VER_EXPORT_VERSION_INFO() +Q_EXPORT_PLUGIN2(VER_MODULE_NAME_STR, Factory) + + +//------------------------------------------------------------------- + +Factory::Factory() + : Plugins::iPluginFactory() + , mTest(0) +{ + setObjectName(QString("%1-Factory").arg(VER_MODULE_NAME_STR)); + + EVAF_INFO("%s created", qPrintable(objectName())); +} + +Factory::~Factory() +{ + if (mTest) + delete mTest; + + EVAF_INFO("%s destroyed", qPrintable(objectName())); +} + +QObject * Factory::create(QString const & name) +{ + if (name == "Test") { + if (mTest == 0) + mTest = new Internal::TestPlugin; + return mTest; + } + else + return 0; +}