From 7167ce41b61d2ba2cdb526777a4233eb84a3b66a Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Sat, 6 Dec 2014 17:33:25 -0500 Subject: Imported Upstream version 2.99.6 --- .../coreSQLiteStudio/plugins/populatedictionary.h | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 SQLiteStudio3/coreSQLiteStudio/plugins/populatedictionary.h (limited to 'SQLiteStudio3/coreSQLiteStudio/plugins/populatedictionary.h') diff --git a/SQLiteStudio3/coreSQLiteStudio/plugins/populatedictionary.h b/SQLiteStudio3/coreSQLiteStudio/plugins/populatedictionary.h new file mode 100644 index 0000000..f5e754f --- /dev/null +++ b/SQLiteStudio3/coreSQLiteStudio/plugins/populatedictionary.h @@ -0,0 +1,52 @@ +#ifndef POPULATEDICTIONARY_H +#define POPULATEDICTIONARY_H + +#include "builtinplugin.h" +#include "populateplugin.h" +#include "config_builder.h" + +class QFile; +class QTextStream; + +CFG_CATEGORIES(PopulateDictionaryConfig, + CFG_CATEGORY(PopulateDictionary, + CFG_ENTRY(QString, File, QString()) + CFG_ENTRY(bool, Lines, false) + CFG_ENTRY(bool, Random, false) + ) +) + +class PopulateDictionary : public BuiltInPlugin, public PopulatePlugin +{ + Q_OBJECT + + SQLITESTUDIO_PLUGIN_TITLE("Dictionary") + SQLITESTUDIO_PLUGIN_DESC("Support for populating tables with values from a dictionary file.") + SQLITESTUDIO_PLUGIN_VERSION(10001) + SQLITESTUDIO_PLUGIN_AUTHOR("sqlitestudio.pl") + + public: + PopulateDictionary(); + + QString getTitle() const; + PopulateEngine* createEngine(); +}; + +class PopulateDictionaryEngine : public PopulateEngine +{ + public: + bool beforePopulating(Db* db, const QString& table); + QVariant nextValue(bool& nextValueError); + void afterPopulating(); + CfgMain* getConfig(); + QString getPopulateConfigFormName() const; + bool validateOptions(); + + private: + CFG_LOCAL(PopulateDictionaryConfig, cfg) + QStringList dictionary; + int dictionarySize = 0; + int dictionaryPos = 0; +}; + +#endif // POPULATEDICTIONARY_H -- cgit v1.2.3