File indexing completed on 2024-05-12 16:39:40

0001 /* This file is part of the KDE project
0002    Copyright (C) 2003-2015 Jarosław Staniek <staniek@kde.org>
0003 
0004    This program is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU Library General Public
0006    License as published by the Free Software Foundation; either
0007    version 2 of the License, or (at your option) any later version.
0008 
0009    This program is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    Library General Public License for more details.
0013 
0014    You should have received a copy of the GNU Library General Public License
0015    along with this program; see the file COPYING.  If not, write to
0016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018  */
0019 
0020 #ifndef KEXIPROJECTSET_H
0021 #define KEXIPROJECTSET_H
0022 
0023 #include "kexiprojectdata.h"
0024 
0025 #include <KDbConnectionData>
0026 #include <KDbResult>
0027 
0028 class KexiProjectSetPrivate;
0029 class KDbMessageHandler;
0030 
0031 /*! @short Stores information about multiple kexi project-data items */
0032 class KEXICORE_EXPORT KexiProjectSet : public KDbResultable
0033 {
0034 public:
0035 
0036     /*! Creates empty project set. Use addProjectData to add a project data.
0037       \a handler can be provided to receive error messages. */
0038     explicit KexiProjectSet(KDbMessageHandler* handler = 0);
0039 
0040     virtual ~KexiProjectSet();
0041 
0042     /*! Fills the set with all projects found using \a conndata (required).
0043     Previous set of projects is removed.
0044     A KDbConnection object is created in this method and immediately deleted afterwards.
0045     @return false on error during project list retrieving. */
0046     bool setConnectionData(KDbConnectionData* conndata);
0047 
0048     /*! Adds \a data as project data.
0049     \a data will be owned by this object. */
0050     void addProjectData(KexiProjectData *data);
0051 
0052     /*! Takes \a data project data from the set without deleting it.
0053         @return 0 if there is no such data in this set. */
0054     KexiProjectData* takeProjectData(KexiProjectData *data);
0055 
0056     //! \return list object
0057     KexiProjectData::List list() const;
0058 
0059     //! Case insensitive lookup.
0060     //! \return project data for databased \a dbName or NULL if not found
0061     KexiProjectData* findProject(const QString &dbName) const;
0062 
0063 private:
0064     Q_DISABLE_COPY(KexiProjectSet)
0065     KexiProjectSetPrivate * const d;
0066 };
0067 
0068 #endif // KEXIPROJECTSET_H
0069