1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
#ifndef REGEXPIMPORT_H
#define REGEXPIMPORT_H
#include "regexpimport_global.h"
#include "plugins/genericplugin.h"
#include "plugins/importplugin.h"
#include "config_builder.h"
class QRegularExpression;
class QFile;
class QTextStream;
CFG_CATEGORIES(RegExpImportConfig,
CFG_CATEGORY(RegExpImport,
CFG_ENTRY(QString, Pattern, QString())
CFG_ENTRY(QString, GroupsMode, "all") // all / custom
CFG_ENTRY(QString, CustomGroupList, QString())
)
)
class REGEXPIMPORTSHARED_EXPORT RegExpImport : public GenericPlugin, public ImportPlugin
{
Q_OBJECT
SQLITESTUDIO_PLUGIN("regexpimport.json")
public:
RegExpImport();
bool init();
void deinit();
QString getDataSourceTypeName() const;
ImportManager::StandardConfigFlags standardOptionsToEnable() const;
QString getFileFilter() const;
bool beforeImport(const ImportManager::StandardImportConfig& config);
void afterImport();
QList<ColumnDefinition> getColumns() const;
QList<QVariant> next();
CfgMain* getConfig();
QString getImportConfigFormName() const;
bool validateOptions();
private:
CFG_LOCAL_PERSISTABLE(RegExpImportConfig, cfg)
QRegularExpression* re = nullptr;
QList<QVariant> groups;
QStringList columns;
QFile* file = nullptr;
QTextStream* stream = nullptr;
QString buffer;
};
#endif // REGEXPIMPORT_H
|