2016-05-12 14:08:58 +08:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Nut project.
|
|
|
|
|
** https://github.com/HamedMasafi/Nut
|
|
|
|
|
**
|
|
|
|
|
** Nut is free software: you can redistribute it and/or modify
|
|
|
|
|
** it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
|
** the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
** (at your option) any later version.
|
|
|
|
|
**
|
|
|
|
|
** Nut is distributed in the hope that it will be useful,
|
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
** GNU Lesser General Public License for more details.
|
|
|
|
|
**
|
|
|
|
|
** You should have received a copy of the GNU Lesser General Public License
|
|
|
|
|
** along with Nut. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef TABLESETBASE_H
|
|
|
|
|
#define TABLESETBASE_H
|
|
|
|
|
|
|
|
|
|
#include <QtCore/QObject>
|
|
|
|
|
#include <QtCore/qglobal.h>
|
|
|
|
|
#include <QtCore/QSet>
|
2019-06-18 23:37:03 +08:00
|
|
|
#include <QExplicitlySharedDataPointer>
|
2016-05-12 14:08:58 +08:00
|
|
|
|
|
|
|
|
#include "defines.h"
|
|
|
|
|
|
2017-02-01 18:01:21 +08:00
|
|
|
NUT_BEGIN_NAMESPACE
|
|
|
|
|
|
2016-05-12 14:08:58 +08:00
|
|
|
class Table;
|
|
|
|
|
class Database;
|
2019-06-18 23:37:03 +08:00
|
|
|
class TableSetBaseData;
|
2016-05-12 14:08:58 +08:00
|
|
|
class TableSetBase : public QObject
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public:
|
2018-02-26 18:14:36 +08:00
|
|
|
explicit TableSetBase(Database *parent);
|
|
|
|
|
explicit TableSetBase(Table *parent);
|
2019-03-08 00:15:58 +08:00
|
|
|
virtual ~TableSetBase();
|
2016-05-12 14:08:58 +08:00
|
|
|
|
2017-09-10 22:18:20 +08:00
|
|
|
virtual int save(Database *db, bool cleanUp = false);
|
2016-05-21 16:09:03 +08:00
|
|
|
void clearChilds();
|
2016-05-12 14:08:58 +08:00
|
|
|
QString childClassName() const;
|
|
|
|
|
|
2016-05-21 16:09:03 +08:00
|
|
|
Database *database() const;
|
|
|
|
|
void setDatabase(Database *database);
|
|
|
|
|
|
2016-05-12 14:08:58 +08:00
|
|
|
protected:
|
2019-06-18 23:37:03 +08:00
|
|
|
QExplicitlySharedDataPointer<TableSetBaseData> data;
|
2018-01-10 06:08:19 +08:00
|
|
|
|
2019-07-08 22:53:02 +08:00
|
|
|
public://TODO: change this to private
|
2019-07-17 21:43:30 +08:00
|
|
|
// void add(Table* t);
|
|
|
|
|
// void remove(Table *t);
|
2018-01-10 06:08:19 +08:00
|
|
|
|
2019-07-08 22:53:02 +08:00
|
|
|
void add(Row<Table> t);
|
|
|
|
|
void remove(Row<Table> t);
|
|
|
|
|
|
2018-01-10 06:08:19 +08:00
|
|
|
friend class Table;
|
|
|
|
|
friend class QueryBase;
|
2016-05-12 14:08:58 +08:00
|
|
|
};
|
|
|
|
|
|
2017-02-01 18:01:21 +08:00
|
|
|
NUT_END_NAMESPACE
|
|
|
|
|
|
2016-05-12 14:08:58 +08:00
|
|
|
#endif // TABLESETBASE_H
|