本文整理汇总了C++中QByteArray::resetRawData方法的典型用法代码示例。如果您正苦于以下问题:C++ QByteArray::resetRawData方法的具体用法?C++ QByteArray::resetRawData怎么用?C++ QByteArray::resetRawData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QByteArray
的用法示例。
在下文中一共展示了QByteArray::resetRawData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get
void kio_afpProtocol::get(const KURL& url )
{
kdDebug(7101) << "\n\nget " << url.prettyURL() << endl;
struct afp_url afp_url;
int ret;
unsigned int fileid;
unsigned long long total=0;
QString resumeOffset = metaData("resume");
// bool ok;
// struct stat stat;
// KIO::fileoffset_t offset = resumeOffset.toLongLong(&ok);
QString kafpurl = url.url(0,0);
afp_default_url(&afp_url);
afp_parse_url(&afp_url,kafpurl,0);
if (attachvolume(&afp_url)==false) {
kdDebug(7101) << "could not attach for get of " << url.prettyURL() << endl;
finished();
return;
}
ret=afp_sl_open(NULL,NULL,&afp_url, &fileid,0);
#if 0
char buffer[GET_DATA_SIZE];
QByteArray array;
while (eof==0) {
ret = afp_sl_read(&connection,&volid,fileid,0,
offset, GET_DATA_SIZE,&received,&eof,buffer);
array.setRawData(buffer,received);
data(array);
array.resetRawData(buffer,received);
total+=received;
offset=total;
}
infoMessage( i18n( "Retrieving %1 from %2...")
.arg(KIO::convertSize(retreived)) .arg(afp_url.servername));
#endif
totalSize(total);
ret=afp_sl_close(&volumeid,fileid);
}
示例2: loadFromData
bool QPixmap::loadFromData( const uchar *buf, uint len, const char *format,
int conversion_flags )
{
QByteArray a;
a.setRawData( (char *)buf, len );
QBuffer b( a );
b.open( IO_ReadOnly );
QImageIO io( &b, format );
bool result = io.read();
b.close();
a.resetRawData( (char *)buf, len );
if ( result ) {
detach();
result = convertFromImage( io.image(), conversion_flags );
}
return result;
}