aspirinus

Логика

May 9th, 2012
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. template <typename T>
  2. qint64 write_helper(QFile *file, const QScriptValue &value, T *dummy = 0)
  3. {
  4.     Q_UNUSED(dummy)
  5.     int count = value.property("length").toInt32();
  6.     QByteArray ba(count * sizeof(T), '\0');
  7.     QDataStream s(&ba, QIODevice::WriteOnly);
  8.  
  9.     for (int i = 0; i < count; ++i)
  10.         s << value.property(i).toVariant().value<T>();
  11.  
  12.     return file->write(ba);
  13. }
Advertisement
Add Comment
Please, Sign In to add comment