KDb

KDbDriverMetaData.cpp
1 /* This file is part of the KDE project
2  Copyright (C) 2003-2016 JarosÅ‚aw Staniek <[email protected]>
3 
4  This program is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this program; see the file COPYING. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18 */
19 
20 #include "KDbDriverMetaData.h"
21 
22 #include <QStringList>
23 
24 static bool isTrue(KPluginMetaData *metaData, const char* fieldName)
25 {
26  return 0 == metaData->value(QLatin1String(fieldName))
27  .compare(QLatin1String("true"), Qt::CaseInsensitive);
28 }
29 
30 class Q_DECL_HIDDEN KDbDriverMetaData::Private
31 {
32 public:
33  explicit Private(KDbDriverMetaData *metaData)
34  : fileBased(isTrue(metaData, "X-KDb-FileBased"))
35  , importingEnabled(isTrue(metaData, "X-KDb-ImportingEnabled"))
36  {
37  }
38 
40  bool fileBased;
41  bool importingEnabled;
42 private:
43  Q_DISABLE_COPY(Private)
44 };
45 
46 // ---
47 
48 KDbDriverMetaData::KDbDriverMetaData(const QPluginLoader &loader)
49  : KPluginMetaData(loader), d(new Private(this))
50 {
51 }
52 
53 KDbDriverMetaData::~KDbDriverMetaData()
54 {
55  delete d;
56 }
57 
59 {
60  return pluginId();
61 }
62 
64 {
65  return d->fileBased;
66 }
67 
69 {
70  return d->importingEnabled;
71 }
bool isImportingEnabled() const
Provides information about a single driver plugin.
CaseInsensitive
bool value(const QString &key, bool defaultValue) const
QString id() const
QStringList mimeTypes(Mode mode=Writing)
QString pluginId() const
bool isFileBased() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Jun 25 2022 06:21:33 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.