mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-24 12:34:39 +03:00
IDataSource extracted to own file
This commit is contained in:
parent
3b94666a33
commit
e5a0d2943d
@ -32,6 +32,7 @@
|
||||
|
||||
#include "lrcallbackdatasourceintf.h"
|
||||
#include "lrglobal.h"
|
||||
#include "lrdatasourceintf.h"
|
||||
|
||||
class QVariant;
|
||||
class QString;
|
||||
@ -40,12 +41,14 @@ namespace LimeReport{
|
||||
|
||||
class IDbCredentialsProvider{
|
||||
public:
|
||||
virtual ~IDbCredentialsProvider(){}
|
||||
virtual QString getUserName(const QString& connectionName) = 0;
|
||||
virtual QString getPassword(const QString& connectionName) = 0;
|
||||
};
|
||||
|
||||
class IDataSourceManager{
|
||||
public:
|
||||
virtual ~IDataSourceManager(){}
|
||||
virtual void setReportVariable(const QString& name, const QVariant& value) = 0;
|
||||
virtual void setDefaultDatabasePath(const QString &defaultDatabasePath) = 0;
|
||||
virtual void deleteVariable(const QString& name) = 0;
|
||||
@ -57,12 +60,13 @@ public:
|
||||
virtual void clearUserVariables()=0;
|
||||
virtual ICallbackDatasource* createCallbackDatasource(const QString& name) = 0;
|
||||
virtual void registerDbCredentialsProvider(IDbCredentialsProvider* provider) = 0;
|
||||
|
||||
virtual QStringList variableNames() = 0;
|
||||
virtual bool variableIsMandatory(const QString& name) = 0;
|
||||
virtual VariableDataType variableDataType(const QString& name) = 0;
|
||||
virtual bool variableIsSystem(const QString& name) = 0;
|
||||
virtual IDataSource* dataSource(const QString& name) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
#endif // LRDATASOURCEMANAGERINTF_H
|
||||
|
||||
|
@ -131,6 +131,7 @@ HEADERS += \
|
||||
$$REPORT_PATH/lrvariablesholder.h \
|
||||
$$REPORT_PATH/lrgroupfunctions.h \
|
||||
$$REPORT_PATH/lrreportengine.h \
|
||||
$$REPORT_PATH/lrdatasourceintf.h \
|
||||
$$REPORT_PATH/lrdatasourcemanagerintf.h \
|
||||
$$REPORT_PATH/lrscriptenginemanagerintf.h \
|
||||
$$REPORT_PATH/lrsimplecrypt.h \
|
||||
|
@ -34,6 +34,7 @@ contains(CONFIG, staticlib){
|
||||
|
||||
EXTRA_FILES += \
|
||||
$$PWD/lrglobal.h \
|
||||
$$PWD/lrdatasourceintf.h \
|
||||
$$PWD/lrdatasourcemanagerintf.h \
|
||||
$$PWD/lrreportengine.h \
|
||||
$$PWD/lrscriptenginemanagerintf.h \
|
||||
|
@ -40,46 +40,47 @@
|
||||
#include <QVariant>
|
||||
#include "lrcollection.h"
|
||||
#include "lrcallbackdatasourceintf.h"
|
||||
#include "lrdatasourceintf.h"
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
class DataSourceManager;
|
||||
|
||||
class IDataSource {
|
||||
public:
|
||||
enum DatasourceMode{DESIGN_MODE,RENDER_MODE};
|
||||
typedef QSharedPointer<IDataSource> Ptr;
|
||||
virtual ~IDataSource(){}
|
||||
virtual bool next() = 0;
|
||||
virtual bool hasNext() = 0;
|
||||
virtual bool prior() = 0;
|
||||
virtual void first() = 0;
|
||||
virtual void last() = 0;
|
||||
virtual bool bof() = 0;
|
||||
virtual bool eof() = 0;
|
||||
virtual QVariant data(const QString& columnName) = 0;
|
||||
virtual QVariant dataByKeyField(const QString& columnName, const QString& keyColumnName, QVariant keyData) = 0;
|
||||
virtual int columnCount() = 0;
|
||||
virtual QString columnNameByIndex(int columnIndex) = 0;
|
||||
virtual int columnIndexByName(QString name) = 0;
|
||||
virtual bool isInvalid() const = 0;
|
||||
virtual QString lastError() = 0;
|
||||
virtual QAbstractItemModel* model() = 0;
|
||||
};
|
||||
//class IDataSource {
|
||||
//public:
|
||||
// enum DatasourceMode{DESIGN_MODE,RENDER_MODE};
|
||||
// typedef QSharedPointer<IDataSource> Ptr;
|
||||
// virtual ~IDataSource(){}
|
||||
// virtual bool next() = 0;
|
||||
// virtual bool hasNext() = 0;
|
||||
// virtual bool prior() = 0;
|
||||
// virtual void first() = 0;
|
||||
// virtual void last() = 0;
|
||||
// virtual bool bof() = 0;
|
||||
// virtual bool eof() = 0;
|
||||
// virtual QVariant data(const QString& columnName) = 0;
|
||||
// virtual QVariant dataByKeyField(const QString& columnName, const QString& keyColumnName, QVariant keyData) = 0;
|
||||
// virtual int columnCount() = 0;
|
||||
// virtual QString columnNameByIndex(int columnIndex) = 0;
|
||||
// virtual int columnIndexByName(QString name) = 0;
|
||||
// virtual bool isInvalid() const = 0;
|
||||
// virtual QString lastError() = 0;
|
||||
// virtual QAbstractItemModel* model() = 0;
|
||||
//};
|
||||
|
||||
class IDataSourceHolder {
|
||||
public:
|
||||
virtual IDataSource* dataSource(IDataSource::DatasourceMode mode = IDataSource::RENDER_MODE) = 0;
|
||||
virtual QString lastError() const = 0;
|
||||
virtual bool isInvalid() const = 0;
|
||||
virtual bool isOwned() const = 0;
|
||||
virtual bool isEditable() const = 0;
|
||||
virtual bool isRemovable() const = 0;
|
||||
virtual void invalidate(IDataSource::DatasourceMode mode, bool dbWillBeClosed = false) = 0;
|
||||
virtual void update() = 0;
|
||||
virtual void clearErrors() = 0;
|
||||
virtual ~IDataSourceHolder(){}
|
||||
};
|
||||
//class IDataSourceHolder {
|
||||
//public:
|
||||
// virtual IDataSource* dataSource(IDataSource::DatasourceMode mode = IDataSource::RENDER_MODE) = 0;
|
||||
// virtual QString lastError() const = 0;
|
||||
// virtual bool isInvalid() const = 0;
|
||||
// virtual bool isOwned() const = 0;
|
||||
// virtual bool isEditable() const = 0;
|
||||
// virtual bool isRemovable() const = 0;
|
||||
// virtual void invalidate(IDataSource::DatasourceMode mode, bool dbWillBeClosed = false) = 0;
|
||||
// virtual void update() = 0;
|
||||
// virtual void clearErrors() = 0;
|
||||
// virtual ~IDataSourceHolder(){}
|
||||
//};
|
||||
|
||||
class ModelHolder: public QObject, public IDataSourceHolder{
|
||||
Q_OBJECT
|
||||
|
47
limereport/lrdatasourceintf.h
Normal file
47
limereport/lrdatasourceintf.h
Normal file
@ -0,0 +1,47 @@
|
||||
#ifndef LRDATASOURCEINTF_H
|
||||
#define LRDATASOURCEINTF_H
|
||||
#include <QSharedPointer>
|
||||
#include <QAbstractItemModel>
|
||||
namespace LimeReport {
|
||||
|
||||
class IDataSource {
|
||||
public:
|
||||
enum DatasourceMode{DESIGN_MODE,RENDER_MODE};
|
||||
typedef QSharedPointer<IDataSource> Ptr;
|
||||
virtual ~IDataSource() {}
|
||||
virtual bool next() = 0;
|
||||
virtual bool hasNext() = 0;
|
||||
virtual bool prior() = 0;
|
||||
virtual void first() = 0;
|
||||
virtual void last() = 0;
|
||||
virtual bool bof() = 0;
|
||||
virtual bool eof() = 0;
|
||||
virtual QVariant data(const QString& columnName) = 0;
|
||||
virtual QVariant dataByKeyField(const QString& columnName, const QString& keyColumnName, QVariant keyData) = 0;
|
||||
virtual int columnCount() = 0;
|
||||
virtual QString columnNameByIndex(int columnIndex) = 0;
|
||||
virtual int columnIndexByName(QString name) = 0;
|
||||
virtual bool isInvalid() const = 0;
|
||||
virtual QString lastError() = 0;
|
||||
virtual QAbstractItemModel* model() = 0;
|
||||
};
|
||||
|
||||
class IDataSourceHolder {
|
||||
public:
|
||||
virtual ~IDataSourceHolder(){}
|
||||
virtual IDataSource* dataSource(IDataSource::DatasourceMode mode = IDataSource::RENDER_MODE) = 0;
|
||||
virtual QString lastError() const = 0;
|
||||
virtual bool isInvalid() const = 0;
|
||||
virtual bool isOwned() const = 0;
|
||||
virtual bool isEditable() const = 0;
|
||||
virtual bool isRemovable() const = 0;
|
||||
virtual void invalidate(IDataSource::DatasourceMode mode, bool dbWillBeClosed = false) = 0;
|
||||
virtual void update() = 0;
|
||||
virtual void clearErrors() = 0;
|
||||
};
|
||||
|
||||
} // namespace LimeReport
|
||||
|
||||
#endif // LRDATASOURCEINTF_H
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "lrvariablesholder.h"
|
||||
#include "lrgroupfunctions.h"
|
||||
#include "lrdatasourcemanagerintf.h"
|
||||
#include "lrdatasourceintf.h"
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
#include "lrcallbackdatasourceintf.h"
|
||||
#include "lrglobal.h"
|
||||
#include "lrdatasourceintf.h"
|
||||
|
||||
class QVariant;
|
||||
class QString;
|
||||
@ -40,12 +41,14 @@ namespace LimeReport{
|
||||
|
||||
class IDbCredentialsProvider{
|
||||
public:
|
||||
virtual ~IDbCredentialsProvider(){}
|
||||
virtual QString getUserName(const QString& connectionName) = 0;
|
||||
virtual QString getPassword(const QString& connectionName) = 0;
|
||||
};
|
||||
|
||||
class IDataSourceManager{
|
||||
public:
|
||||
virtual ~IDataSourceManager(){}
|
||||
virtual void setReportVariable(const QString& name, const QVariant& value) = 0;
|
||||
virtual void setDefaultDatabasePath(const QString &defaultDatabasePath) = 0;
|
||||
virtual void deleteVariable(const QString& name) = 0;
|
||||
@ -57,12 +60,13 @@ public:
|
||||
virtual void clearUserVariables()=0;
|
||||
virtual ICallbackDatasource* createCallbackDatasource(const QString& name) = 0;
|
||||
virtual void registerDbCredentialsProvider(IDbCredentialsProvider* provider) = 0;
|
||||
|
||||
virtual QStringList variableNames() = 0;
|
||||
virtual bool variableIsMandatory(const QString& name) = 0;
|
||||
virtual VariableDataType variableDataType(const QString& name) = 0;
|
||||
virtual bool variableIsSystem(const QString& name) = 0;
|
||||
virtual IDataSource* dataSource(const QString& name) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
#endif // LRDATASOURCEMANAGERINTF_H
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user