2013-07-02 00:00:58 +08:00
|
|
|
#ifndef QREDIS_REQUEST_H
|
|
|
|
|
#define QREDIS_REQUEST_H
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
#include <QScopedPointer>
|
2013-07-05 00:25:46 +08:00
|
|
|
#include <QVariantList>
|
2013-07-02 00:00:58 +08:00
|
|
|
|
2013-08-02 06:43:58 +08:00
|
|
|
#include <qredis/reply.h>
|
2013-07-02 00:00:58 +08:00
|
|
|
#include "qredis_export.h"
|
|
|
|
|
|
|
|
|
|
namespace QRedis
|
|
|
|
|
{
|
|
|
|
|
class QREDIS_EXPORT RequestPrivate;
|
|
|
|
|
|
|
|
|
|
/**
|
2013-07-03 06:26:19 +08:00
|
|
|
* @brief Represents a request and its reply
|
2013-07-02 00:00:58 +08:00
|
|
|
*/
|
|
|
|
|
class QREDIS_EXPORT Request : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Creates a request
|
|
|
|
|
* @param parent
|
|
|
|
|
*/
|
2013-07-03 06:26:19 +08:00
|
|
|
explicit Request(QObject * parent = 0);
|
2013-07-02 00:00:58 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Destroys the request
|
|
|
|
|
*/
|
|
|
|
|
virtual ~Request();
|
|
|
|
|
|
|
|
|
|
/**
|
2013-07-03 06:26:19 +08:00
|
|
|
* @brief Waits for the reply to be received
|
|
|
|
|
* @param msecs the amount of time in milliseconds to wait
|
|
|
|
|
* @return true if the reply was received
|
2013-07-02 00:00:58 +08:00
|
|
|
*/
|
2013-07-03 06:26:19 +08:00
|
|
|
bool waitForReply(int msecs = 30000);
|
2013-07-02 00:00:58 +08:00
|
|
|
|
2013-07-03 06:26:19 +08:00
|
|
|
Q_SIGNALS:
|
2013-07-02 00:00:58 +08:00
|
|
|
|
|
|
|
|
/**
|
2013-08-02 06:43:58 +08:00
|
|
|
* @brief Emitted when a reply is received
|
|
|
|
|
* @param reply the reply received
|
2013-07-05 00:25:46 +08:00
|
|
|
*/
|
2013-08-02 06:43:58 +08:00
|
|
|
void reply(Reply & reply);
|
2013-07-05 05:14:53 +08:00
|
|
|
|
2013-07-02 00:00:58 +08:00
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
const QScopedPointer<RequestPrivate> d;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif // QREDIS_REQUEST_H
|