Started work on MsgPackStream

This commit is contained in:
Roman committed 2015-05-02 00:06:35 +03:00
1 parent 3b0d6e3c31
commit 1ae96715cf
9 files changed
+154 -344

No files matched your search

+49
View File
@@ -0,0 +1,49 @@
#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