qgenericpluginfactory.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/kernel/qgenericpluginfactory.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2015 The Qt Company Ltd.-
4** Contact: http://www.qt.io/licensing/-
5**-
6** This file is part of the QtGui module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL21$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see http://www.qt.io/terms-conditions. For further-
15** information use the contact form at http://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 2.1 or version 3 as published by the Free-
20** Software Foundation and appearing in the file LICENSE.LGPLv21 and-
21** LICENSE.LGPLv3 included in the packaging of this file. Please review the-
22** following information to ensure the GNU Lesser General Public License-
23** requirements will be met: https://www.gnu.org/licenses/lgpl.html and-
24** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.-
25**-
26** As a special exception, The Qt Company gives you certain additional-
27** rights. These rights are described in The Qt Company LGPL Exception-
28** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.-
29**-
30** $QT_END_LICENSE$-
31**-
32****************************************************************************/-
33-
34#include "qgenericpluginfactory.h"-
35-
36#include "qguiapplication.h"-
37#include "private/qfactoryloader_p.h"-
38#include "qgenericplugin.h"-
39#include "qdebug.h"-
40-
41QT_BEGIN_NAMESPACE-
42-
43#if !defined(Q_OS_WIN32) || defined(QT_SHARED)-
44#ifndef QT_NO_LIBRARY-
45-
46Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
never executed: end of block
never executed: guard.store(QtGlobalStatic::Destroyed);
never executed: return &holder.value;
guard.load() =...c::InitializedDescription
TRUEnever evaluated
FALSEnever evaluated
0
47 (QGenericPluginFactoryInterface_iid,-
48 QLatin1String("/generic"), Qt::CaseInsensitive))-
49-
50#endif //QT_NO_LIBRARY-
51#endif //QT_SHARED-
52-
53/*!-
54 \class QGenericPluginFactory-
55 \ingroup plugins-
56 \inmodule QtGui-
57-
58 \brief The QGenericPluginFactory class creates plugin drivers.-
59-
60 \sa QGenericPlugin-
61*/-
62-
63/*!-
64 Creates the driver specified by \a key, using the given \a specification.-
65-
66 Note that the keys are case-insensitive.-
67-
68 \sa keys()-
69*/-
70QObject *QGenericPluginFactory::create(const QString& key, const QString &specification)-
71{-
72#if (!defined(Q_OS_WIN32) || defined(QT_SHARED)) && !defined(QT_NO_LIBRARY)-
73 const QString driver = key.toLower();-
74 if (QObject *object = qLoadPlugin1<QObject, QGenericPlugin>(loader(), driver, specification))
QObject *objec...specification)Description
TRUEnever evaluated
FALSEnever evaluated
0
75 return object;
never executed: return object;
0
76#else // (!Q_OS_WIN32 || QT_SHARED) && !QT_NO_LIBRARY-
77 Q_UNUSED(key)-
78 Q_UNUSED(specification)-
79#endif-
80 return 0;
never executed: return 0;
0
81}-
82-
83/*!-
84 Returns the list of valid keys, i.e. the available mouse drivers.-
85-
86 \sa create()-
87*/-
88QStringList QGenericPluginFactory::keys()-
89{-
90 QStringList list;-
91-
92#if !defined(Q_OS_WIN32) || defined(QT_SHARED)-
93#ifndef QT_NO_LIBRARY-
94 typedef QMultiMap<int, QString> PluginKeyMap;-
95 typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator;-
96-
97 const PluginKeyMap keyMap = loader()->keyMap();-
98 const PluginKeyMapConstIterator cend = keyMap.constEnd();-
99 for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it)
it != cendDescription
TRUEnever evaluated
FALSEnever evaluated
0
100 if (!list.contains(it.value()))
!list.contains(it.value())Description
TRUEnever evaluated
FALSEnever evaluated
0
101 list += it.value();
never executed: list += it.value();
0
102#endif //QT_NO_LIBRARY-
103#endif-
104 return list;
never executed: return list;
0
105}-
106-
107QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9