Files
qmsgpack/src/stream.h
T

49 lines
1.3 KiB
C++
Raw Normal View History

2015-05-02 00:06:35 +03:00
#ifndef STREAM_H
#define STREAM_H
#include <QIODevice>
class MsgPackStream
{
public:
MsgPackStream();
MsgPackStream(QIODevice *d);
MsgPackStream(QByteArray *a, QIODevice::OpenMode mode);
MsgPackStream(const QByteArray &a);
virtual ~MsgPackStream();
void setDevice(QIODevice *d);
QIODevice *device() const;
bool atEnd() const;
void setCompatibility(bool isEnabled);
enum Status {Ok, ReadPastEnd, ReadCorruptData, WriteFailed};
Status status() const;
void resetStatus();
void setStatus(Status status);
MsgPackStream &operator>>(bool &b);
MsgPackStream &operator>>(quint8 &u8);
MsgPackStream &operator>>(quint16 &u16);
MsgPackStream &operator>>(quint32 &u32);
MsgPackStream &operator>>(quint64 &u64);
MsgPackStream &operator>>(qint8 &i8);
MsgPackStream &operator>>(qint16 &i16);
MsgPackStream &operator>>(qint32 &i32);
MsgPackStream &operator>>(qint64 &i64);
MsgPackStream &operator>>(float &f);
MsgPackStream &operator>>(double &d);
MsgPackStream &operator>>(QString &str);
MsgPackStream &operator>>(QByteArray &array);
MsgPackStream &operator>>(QVariantList &list);
MsgPackStream &operator>>(QVariantMap &map);
private:
QIODevice *dev;
bool compatibility;
bool owndev;
Status q_status;
};
#endif // STREAM_H