TransportStub.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef PROTOCOLS__GENERICS__TESTING__TRANSPORT_STUB_H
00024 #define PROTOCOLS__GENERICS__TESTING__TRANSPORT_STUB_H
00025
00026 #include "Imports.h"
00027 #include "../Transport.h"
00028
00029 namespace Protocols {
00030 namespace Generics {
00031 namespace Testing {
00032
00034
00051 class TransportStub : public Transport
00052 {
00053 public:
00054 TransportStub();
00055
00056
00057 void connectToNode (const Uri &);
00058 void disconnectFromNode();
00059 void abort();
00060
00061
00062
00063
00064
00065 bool canRead (int count) const;
00066
00067 QByteArray peek (int count) const;
00068 QByteArray peekAtMost (int count) const;
00069 QByteArray peekTo (const QByteArray &delimiter) const;
00070 QByteArray peekAll() const;
00071
00072 QByteArray read (int count);
00073 QByteArray readAtMost (int count);
00074 QByteArray readTo (const QByteArray &delimiter);
00075 QByteArray readAll();
00076
00077 bool canWrite (int count) const;
00078
00079 bool write (const QByteArray &bytes, bool flush);
00080
00081
00082 void setTransportStatus (TransportStatus *);
00083
00084
00085 operator Transport *();
00086
00087
00088 QByteArray readBuffer;
00089 QByteArray writeBuffer;
00090 TransportStatus *status;
00091 };
00092
00093 }
00094 }
00095 }
00096
00097 #endif // PROTOCOLS__GENERICS__TESTING__TRANSPORT_STUB_H