1 /*=============================================================================
2 
3   Library: CTK
4 
5   Copyright (c) German Cancer Research Center,
6     Division of Medical and Biological Informatics
7 
8   Licensed under the Apache License, Version 2.0 (the "License");
9   you may not use this file except in compliance with the License.
10   You may obtain a copy of the License at
11 
12     http://www.apache.org/licenses/LICENSE-2.0
13 
14   Unless required by applicable law or agreed to in writing, software
15   distributed under the License is distributed on an "AS IS" BASIS,
16   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   See the License for the specific language governing permissions and
18   limitations under the License.
19 
20 =============================================================================*/
21 
22 
23 #include "ctkPluginGeneratorCorePlugin_p.h"
24 
25 #include "ctkPluginGeneratorCodeModel.h"
26 
27 #include <QtPlugin>
28 
29 ctkPluginGeneratorCorePlugin* ctkPluginGeneratorCorePlugin::instance = 0;
30 
start(ctkPluginContext * context)31 void ctkPluginGeneratorCorePlugin::start(ctkPluginContext* context)
32 {
33   pluginContext = context;
34   instance = this;
35 
36   codeModel = new ctkPluginGeneratorCodeModel();
37   context->registerService(QStringList("ctkPluginGeneratorCodeModel"), codeModel);
38 }
39 
stop(ctkPluginContext * context)40 void ctkPluginGeneratorCorePlugin::stop(ctkPluginContext* context)
41 {
42   Q_UNUSED(context);
43 
44   delete codeModel;
45   instance = 0;
46 }
47 
getContext() const48 ctkPluginContext* ctkPluginGeneratorCorePlugin::getContext() const
49 {
50   return pluginContext;
51 }
52 
getCodeModel() const53 ctkPluginGeneratorCodeModel* ctkPluginGeneratorCorePlugin::getCodeModel() const
54 {
55   return codeModel;
56 }
57 
getInstance()58 ctkPluginGeneratorCorePlugin* ctkPluginGeneratorCorePlugin::getInstance()
59 {
60   return instance;
61 }
62 
63 #if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
64 Q_EXPORT_PLUGIN2(org_commontk_plugingenerator_core, ctkPluginGeneratorCorePlugin)
65 #endif
66