forked from thoughtbot/capybara-webkit
/
Connection.h
39 lines (32 loc) · 864 Bytes
/
Connection.h
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
#include <QObject>
#include <QStringList>
class QTcpSocket;
class WebPage;
class Command;
class Response;
class Connection : public QObject {
Q_OBJECT
public:
Connection(QTcpSocket *socket, WebPage *page, QObject *parent = 0);
public slots:
void checkNext();
void finishCommand(Response *response);
void pendingLoadFinished(bool success);
private:
void readLine();
void readDataBlock();
void processNext(const char *line);
Command *createCommand(const char *name);
void processArgument(const char *line);
void startCommand();
void writeResponse(Response *response);
QTcpSocket *m_socket;
QString m_commandName;
Command *m_command;
QStringList m_arguments;
int m_argumentsExpected;
WebPage *m_page;
int m_expectingDataSize;
bool m_pageSuccess;
bool m_commandWaiting;
};