Allow streaming uints.

This commit is contained in:
Andrzej Kapolka 2014-03-12 13:03:59 -07:00
parent f088912ecf
commit 6fb313cc43
3 changed files with 16 additions and 1 deletions

View file

@ -265,7 +265,7 @@ template<class T, int bits> inline bool SimpleInlineAttribute<T, bits>::merge(vo
/// Provides appropriate averaging for RGBA values.
class QRgbAttribute : public InlineAttribute<QRgb> {
Q_OBJECT
Q_PROPERTY(unsigned int defaultValue MEMBER _defaultValue)
Q_PROPERTY(uint defaultValue MEMBER _defaultValue)
public:

View file

@ -23,6 +23,7 @@
REGISTER_SIMPLE_TYPE_STREAMER(bool)
REGISTER_SIMPLE_TYPE_STREAMER(int)
REGISTER_SIMPLE_TYPE_STREAMER(uint)
REGISTER_SIMPLE_TYPE_STREAMER(float)
REGISTER_SIMPLE_TYPE_STREAMER(QByteArray)
REGISTER_SIMPLE_TYPE_STREAMER(QColor)
@ -238,6 +239,17 @@ Bitstream& Bitstream::operator>>(int& value) {
return *this;
}
Bitstream& Bitstream::operator<<(uint value) {
return write(&value, 32);
}
Bitstream& Bitstream::operator>>(uint& value) {
quint32 sizedValue;
read(&sizedValue, 32);
value = sizedValue;
return *this;
}
Bitstream& Bitstream::operator<<(float value) {
return write(&value, 32);
}

View file

@ -254,6 +254,9 @@ public:
Bitstream& operator<<(int value);
Bitstream& operator>>(int& value);
Bitstream& operator<<(uint value);
Bitstream& operator>>(uint& value);
Bitstream& operator<<(float value);
Bitstream& operator>>(float& value);