KDb

KDbDriverManager.h
1/* This file is part of the KDE project
2 Copyright (C) 2003 Daniel Molkentin <molkentin@kde.org>
3 Copyright (C) 2003 Joseph Wenninger <jowenn@kde.org>
4 Copyright (C) 2003-2015 Jarosław Staniek <staniek@kde.org>
5 Copyright (C) 2012 Dimitrios T. Tanis <dimitrios.tanis@kdemail.net>
6
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
16
17 You should have received a copy of the GNU Library General Public License
18 along with this program; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21*/
22
23#ifndef KDB_DRIVER_MANAGER_H
24#define KDB_DRIVER_MANAGER_H
25
26#include <QString>
27#include <QCoreApplication>
28
29#include "kdb_export.h"
30
31class KDbResult;
32class KDbResultable;
33class KDbDriver;
35
36//! A driver manager for finding and loading driver plugins.
37class KDB_EXPORT KDbDriverManager
38{
39 Q_DECLARE_TR_FUNCTIONS(KDbDriverManager)
40public:
42 virtual ~KDbDriverManager();
43
44 //! @return result of the recent operation.
45 KDbResult result() const;
46
47 //! @return KDbResultable object for the recent operation.
48 //! It adds serverResultName() in addition to the result().
49 KDbResultable* resultable() const;
50
51 /*! @return information (metadata) about driver with ID @a id.
52 The lookup is case insensitive.
53 The metadata object is owned by KDb internals and is not deleted after
54 this KDbDriverManager object is deleted.
55 @a nullptr is returned if the metadata has not been found.
56 On error status can be obtained using result().
57
58 @see driver(const QString& id) for information about duplicated drivers. */
59 const KDbDriverMetaData* driverMetaData(const QString &id);
60
61 /*! Tries to load db driver with ID @a id.
62 The lookup is case insensitive.
63 @return driver object or @a nullptr on error.
64 On error status can be obtained using result().
65 The driver object is owned by KDb internals and is not deleted after
66 this KDbDriverManager object is deleted.
67
68 @note If more than one driver with the same ID found on the search path, first
69 located driver is selected. All other drivers for this ID are skip with a warning
70 "Driver with ID '...' already found at (path) -- skipping another at (path).
71 The warning can be suppressed by setting a KDB_NO_DUPLICATED_DRIVER_WARNINGS
72 environment variable. */
73 KDbDriver* driver(const QString& id);
74
75 /*! returns list of available drivers IDs.
76 That drivers can be loaded by first use of driver() method. */
77 QStringList driverIds();
78
79 /**
80 * Returns list of driver IDs for @a mimeType MIME type
81 *
82 * IDs of drivers for file-based databases are only returned.
83 * Empty list is returned if no driver has been found for the type or if the type is invalid.
84 * Driver supports the supplied MIME type if it is specified as supported in the driver's
85 * metadata. If a MIME type alias is supplied, proper type for this alias is resolved and driver
86 * IDs for that type are returned. Similarly, if proper MIME type is supplied, IDs are returned
87 * for drivers that support any alias for this type.
88 *
89 * The lookup is case insensitive.
90 */
91 QStringList driverIdsForMimeType(const QString& mimeType);
92
93 /*! @return HTML-formatted message about possible problems encountered.
94 It can be displayed in a 'details' section of a GUI message if an error encountered.
95 Currently the message contains a list of incompatible db drivers.
96 Can be used in code that finds driver depending on file format. */
97//! @todo make it just QStringList
98 QString possibleProblemsMessage() const;
99
100 /*! @return true if there is at least one server-based database driver installed. */
101 bool hasDatabaseServerDrivers();
102
103private:
104 Q_DISABLE_COPY(KDbDriverManager)
105};
106
107#endif
A driver manager for finding and loading driver plugins.
Provides information about a single driver plugin.
Database driver's abstraction.
Definition KDbDriver.h:50
Interface for classes providing a result.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:30 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.