diff options
Diffstat (limited to 'Plugins/DbAndroid/dbandroidconnectionfactory.cpp')
| -rw-r--r-- | Plugins/DbAndroid/dbandroidconnectionfactory.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Plugins/DbAndroid/dbandroidconnectionfactory.cpp b/Plugins/DbAndroid/dbandroidconnectionfactory.cpp new file mode 100644 index 0000000..22377b4 --- /dev/null +++ b/Plugins/DbAndroid/dbandroidconnectionfactory.cpp @@ -0,0 +1,28 @@ +#include "dbandroidconnectionfactory.h" +#include "dbandroidjsonconnection.h" +#include "dbandroidshellconnection.h" + +DbAndroidConnectionFactory::DbAndroidConnectionFactory(DbAndroid* plugin) : + plugin(plugin) +{ +} + +DbAndroidConnection* DbAndroidConnectionFactory::create(const QString& url, QObject* parent) +{ + return create(DbAndroidUrl(url), parent); +} + +DbAndroidConnection* DbAndroidConnectionFactory::create(const DbAndroidUrl& url, QObject* parent) +{ + switch (url.getMode()) + { + case DbAndroidMode::SHELL: + return new DbAndroidShellConnection(plugin, parent); + case DbAndroidMode::NETWORK: + case DbAndroidMode::USB: + return new DbAndroidJsonConnection(plugin, parent); + case DbAndroidMode::null: + break; + } + return nullptr; +} |
