This commit is contained in:
Tim Blume 2021-03-20 17:04:13 +01:00
parent 1baee8c1e7
commit 8b7b40d3ab
5 changed files with 22 additions and 127 deletions

View file

@ -3,6 +3,14 @@
//major minor patch
#define LITTLESNITCH_VERSION 100
#include <QtCore/QtGlobal>
#if defined(IS_PROXY_LIBRARY)
# define MYSHAREDLIB_EXPORT Q_DECL_EXPORT
#else
# define MYSHAREDLIB_EXPORT Q_DECL_IMPORT
#endif
#include <iostream>
#include <map>
#include <vector>

View file

@ -11,22 +11,23 @@ namespace http {
/*!
Interface for implementing proxies
There are no signals, because apparently Qt Plugins do not support interfaces, which inherit from QObject.
(it will fail upon loading the plugin)
You need to implement the following signals:
void process(std::string path); // called in a separate thread, has to block, will not be called again
void finished(); // thread finished and can be deleted
void error(QString err); // an error occured
void message(http::Flow flow); // a http::Flow was received
*/
class ProxyInterface {
public:
std::string path;
virtual ~ProxyInterface() = default;
//! called in a custom thread, may block.
virtual void process(std::string path) = 0;
//! returns, whether the proxy is currently connected
virtual bool connected() = 0;
//! disconnects the handle
virtual void disconnect() = 0;
// options/settings
std::function<void()> finished;
std::function<void(QString)> error;
std::function<void(http::Flow flow)> message;
};
}