本文整理汇总了C++中download函数的典型用法代码示例。如果您正苦于以下问题:C++ download函数的具体用法?C++ download怎么用?C++ download使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了download函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
int DownloadManager::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
switch (_id) {
case 0: downloadComplete(); break;
case 1: progress((*reinterpret_cast< int(*)>(_a[1]))); break;
case 2: downloadStatus((*reinterpret_cast< float(*)>(_a[1]))); break;
case 3: downloadStarted(); break;
case 4: cancel(); break;
case 5: download((*reinterpret_cast< QUrl(*)>(_a[1]))); break;
case 6: pause(); break;
case 7: resume(); break;
case 8: download((*reinterpret_cast< QNetworkRequest(*)>(_a[1]))); break;
case 9: finished(); break;
case 10: downloadProgress((*reinterpret_cast< qint64(*)>(_a[1])),(*reinterpret_cast< qint64(*)>(_a[2]))); break;
case 11: error((*reinterpret_cast< QNetworkReply::NetworkError(*)>(_a[1]))); break;
default: ;
}
_id -= 12;
}
return _id;
}
示例2: InitCode
InitCode() {
void *d1, *d2, *maind;
extern void *download();
d1 = download( RPC_io_code, sizeof( RPC_io_code));
d2 = download( RPC_mo_code, sizeof( RPC_io_code));
drop(d1, d2);
}
示例3: catch
cached<T>::cached(context_t& context, const std::string& collection, const std::string& name) {
api::category_traits<api::storage_t>::ptr_type cache;
try {
cache = api::storage(context, "cache");
} catch(const api::repository_error_t& e) {
download(context, collection, name);
return;
}
T& object = static_cast<T&>(*this);
try {
object = cache->get<T>(collection, name);
} catch(const storage_error_t& e) {
download(context, collection, name);
try {
cache->put(collection, name, object, std::vector<std::string>());
} catch(const storage_error_t& e) {
throw storage_error_t("unable to cache object '%s' in '%s' - %s", name, collection, e.what());
}
return;
}
m_source = sources::cache;
}
示例4: connect
void ListEngine::connectDownloader()
{
connect(this, SIGNAL(download(QUrl,QUrl)), m_parent->downloader(), SLOT(download(QUrl,QUrl)));
connect(m_parent->downloader(), SIGNAL(downloadComplete(QUrl,QUrl)), this, SLOT(downloadComplete(QUrl,QUrl)));
connect(this, SIGNAL(listDir(QUrl)), m_parent->downloader(), SLOT(listDir(QUrl)));
connect(m_parent->downloader(), SIGNAL(listingComplete(QUrl)), this, SLOT(listingComplete(QUrl)));
}
示例5: downloadMarkerPath
void LLUpdateDownloader::Implementation::resume(void)
{
mCancelled = false;
if(isDownloading()) {
mClient.downloadError("download in progress");
}
mDownloadRecordPath = downloadMarkerPath();
llifstream dataStream(mDownloadRecordPath);
if(!dataStream) {
mClient.downloadError("no download marker");
return;
}
LLSDSerialize::fromXMLDocument(mDownloadData, dataStream);
if(!mDownloadData.asBoolean()) {
mClient.downloadError("no download information in marker");
return;
}
std::string filePath = mDownloadData["path"].asString();
try {
if(LLFile::isfile(filePath)) {
llstat fileStatus;
LLFile::stat(filePath, &fileStatus);
if(fileStatus.st_size != mDownloadData["size"].asInteger()) {
resumeDownloading(fileStatus.st_size);
} else if(!validateDownload()) {
LLFile::remove(filePath);
download(LLURI(mDownloadData["url"].asString()),
mDownloadData["hash"].asString(),
mDownloadData["update_version"].asString(),
mDownloadData["required"].asBoolean());
} else {
mClient.downloadComplete(mDownloadData);
}
} else {
download(LLURI(mDownloadData["url"].asString()),
mDownloadData["hash"].asString(),
mDownloadData["update_version"].asString(),
mDownloadData["required"].asBoolean());
}
} catch(DownloadError & e) {
mClient.downloadError(e.what());
}
}
示例6: _dlinfos
RsCollectionDialog::RsCollectionDialog(const QString& CollectionFileName,const std::vector<RsCollectionFile::DLinfo>& dlinfos)
: _dlinfos(dlinfos),_filename(CollectionFileName)
{
setupUi(this) ;
setWindowFlags(Qt::Window); // for maximize button
setWindowFlags(windowFlags() & ~Qt::WindowMinimizeButtonHint);
setWindowTitle(QString("%1 - %2").arg(windowTitle()).arg(QFileInfo(_filename).completeBaseName()));
// 1 - add all elements to the list.
_fileEntriesTW->setColumnCount(3) ;
QTreeWidgetItem *headerItem = _fileEntriesTW->headerItem();
headerItem->setText(0, tr("File"));
headerItem->setText(1, tr("Size"));
headerItem->setText(2, tr("Hash"));
uint32_t size = dlinfos.size();
uint64_t total_size ;
uint32_t total_files ;
for(uint32_t i=0;i<size;++i)
{
const RsCollectionFile::DLinfo &dlinfo = dlinfos[i];
QTreeWidgetItem *item = new QTreeWidgetItem;
item->setFlags(Qt::ItemIsUserCheckable | item->flags());
item->setCheckState(0, Qt::Checked);
item->setData(0, Qt::UserRole, i);
item->setText(0, dlinfo.path + "/" + dlinfo.name);
item->setText(1, misc::friendlyUnit(dlinfo.size));
item->setText(2, dlinfo.hash);
_fileEntriesTW->addTopLevelItem(item);
total_size += dlinfo.size ;
total_files++ ;
}
_filename_TL->setText(_filename) ;
for (int column = 0; column < _fileEntriesTW->columnCount(); ++column) {
_fileEntriesTW->resizeColumnToContents(column);
}
updateSizes() ;
// 2 - connect necessary signals/slots
connectUpdate(true);
connect(_selectAll_PB,SIGNAL(clicked()),this,SLOT(selectAll())) ;
connect(_deselectAll_PB,SIGNAL(clicked()),this,SLOT(deselectAll())) ;
connect(_cancel_PB,SIGNAL(clicked()),this,SLOT(cancel())) ;
connect(_download_PB,SIGNAL(clicked()),this,SLOT(download())) ;
_fileEntriesTW->installEventFilter(this);
}
示例7: open_fpkl
static FILE* open_fpkl()
{
if (system("mkdir -p /data/FeOS/FPM") != 0)
return NULL;
time_t srvTime;
if (!get_cur_pkgtime(&srvTime))
return NULL;
time_t localTime = 0;
do
{
FILE* f = fopen("/data/FeOS/FPM/time", "rb");
if (!f) break;
fread(&localTime, sizeof(localTime), 1, f);
fclose(f);
} while(0);
if (srvTime > localTime)
{
// Need to upgrade!
printf("Downloading package list...\n");
if (!download("/fpkg/", "/data/FeOS/FPM/packages.fpkl", NULL))
return NULL;
FILE* f = fopen("/data/FeOS/FPM/time", "wb");
if (!f)
return NULL;
fwrite(&srvTime, sizeof(srvTime), 1, f);
fclose(f);
}
return fopen("/data/FeOS/FPM/packages.fpkl", "rb");
}
示例8: sbcl_bin_download
int sbcl_bin_download(struct install_options* param) {
int result;
char* home=configdir();
char* arch=arch_(param);
char* uri=get_opt("sbcl-bin-uri",0);
cond_printf(1,"sbcl_bin_download\n");
int retry=10;
do {
param->expand_path=cat(home,"src",SLASH,"sbcl","-",param->version,"-",arch,SLASH,NULL);
impls_sbcl_bin.uri=cat(uri?uri:SBCL_BIN_URI ,param->version,"/sbcl-",param->version,
"-",arch,"-binary",sbcl_bin_extention(param),NULL);
result = download(param);
if(!result && param->version_not_specified) {
int len = strlen(param->version)-1;
if('1'<= param->version[len] && param->version[len] <= '9') {
param->version[len]--;
s(param->expand_path),s(impls_sbcl_bin.uri);
}else if('2' <= param->version[len-1] && param->version[len-1] <= '9') {
param->version[len-1]--;
param->version[len] = '9';
s(param->expand_path),s(impls_sbcl_bin.uri);
}else if('1' == param->version[len-1]) {
param->version[len-1] = '9';
param->version[len] = '\0';
s(param->expand_path),s(impls_sbcl_bin.uri);
}else{
s(arch),s(home);
return 0;
}
}
}while (!result && retry--);
s(arch),s(home);
return !!result;
}
示例9: tileForCoordinate
void SlippyMap::invalidate()
{
if (width <= 0 || height <= 0)
return;
const QPointF ct = tileForCoordinate(latitude, longitude, zoom);
const qreal tx = ct.x();
const qreal ty = ct.y();
// top-left corner of the center tile
const int xp = width / 2 - (tx - floor(tx)) * tdim;
const int yp = height / 2 - (ty - floor(ty)) * tdim;
// first tile vertical and horizontal
const int xa = (xp + tdim - 1) / tdim;
const int ya = (yp + tdim - 1) / tdim;
const int xs = static_cast<int>(tx) - xa;
const int ys = static_cast<int>(ty) - ya;
// offset for top-left tile
m_offset = QPoint(xp - xa * tdim, yp - ya * tdim);
// last tile vertical and horizontal
const int xe = static_cast<int>(tx) + (width - xp - 1) / tdim;
const int ye = static_cast<int>(ty) + (height - yp - 1) / tdim;
// build a rect
m_tilesRect = QRect(xs, ys, xe - xs + 1, ye - ys + 1);
if (m_url.isEmpty())
download();
emit updated(QRect(0, 0, width, height));
}
示例10: qDebug
void CachedImage::_setProperties()
{
if (!_headReply)
return;
if (_headReply->error() != QNetworkReply::NoError)
{
_headReply->deleteLater();
_headReply = nullptr;
return;
}
auto mime = _headReply->header(QNetworkRequest::ContentTypeHeader).toString().split('/');
if (mime.isEmpty())
mime << "";
if (!mime.first().isEmpty() && mime.first().toLower() != "image")
qDebug() << "mime:" << mime.first() << "\nurl:" << _url;
setExtension(mime.last());
auto length = _headReply->header(QNetworkRequest::ContentLengthHeader).toInt();
_kbytesTotal = length / 1024;
emit totalChanged();
_headReply->deleteLater();
_headReply = nullptr;
if (_man->autoload(_kbytesTotal))
download();
}
示例11: decodeName
void BrowserDialog::linkClicked(const QUrl& url)
{
do {
if (url.host() != DOWNLOAD_HOST_BASE) {
break;
}
if (url.path() != "/dict/download_cell.php") {
break;
}
QString id = url.queryItemValue("id");
QByteArray name = url.encodedQueryItemValue("name");
QString sname = decodeName(name);
m_name = sname;
if (!id.isEmpty() && !sname.isEmpty()) {
download(url);
return;
}
} while(0);
if (url.host() != HOST_BASE) {
QMessageBox::information(this, _("Wrong Link"),
_("No browsing outside pinyin.sogou.com, now redirect to home page."));
m_ui->webView->load(QUrl(URL_BASE));
} else {
m_ui->webView->load(url);
}
}
示例12: fileInfo
void DownloadM::download( QUrl url , QString matchMd5 )
{
url0 = url;
QFileInfo fileInfo(url.path());
QString filename;
filename=fileInfo.fileName();
curentMd5 = matchMd5;
dDlSizeAtPause = 0;
dCurrentRequest = QNetworkRequest(url);
// remove the older file that has the same name
if(filename.contains(".pk3", Qt::CaseInsensitive) || filename.contains(".cfg", Qt::CaseInsensitive)
|| filename.contains(".txt", Qt::CaseInsensitive))
QFile::remove(assetsDir+"/"+filename);
else
QFile::remove(filename);
dFile = new QFile(filename);
dFile->open(QIODevice::ReadWrite);
downloadTime.start();
download(dCurrentRequest);
}
示例13: CCLOG
void AssetsUpdateLayer::update(float delta)
{
if (1 || m_curBigVersion >= m_endBigVersion && m_curSmallVersion >= m_endSmallVersion)
{
CCLOG("Version check Ok");
unscheduleUpdate();
//MD5Check();
gameEnter();
return;
}
if (!m_isDownloading && checkUpdate())
{
createLayerItem();
char str[128];
sprintf(str, "%s%s%d.%d.%d.zip", SERVER_ADDRESS, ASSETS_SERVER_PATH, m_curBigVersion, m_curMidVersion, m_curSmallVersion + 1);
getAssetsManager()->setPackageUrl(str);
sprintf(str, "%d.%d.%d", m_curBigVersion, m_curMidVersion, m_curSmallVersion + 1);
getAssetsManager()->setVersionFileUrl(str);
getAssetsManager()->setStoragePath(m_pathToSave.c_str());
//sprintf(str, Localization::getInstance()->getValueByKey("Loading_download_restBag_num"), m_endSmallVersion - m_curSmallVersion);
//m_packegNumberLabel->setString(str);
m_curPackageLength = 0;
//getAssetsManager()->getPackageLength((long&)m_packageLength);
m_isDownloading = true;
download();
}
}
示例14: selectedRow
void LibrariesForm::on_downloadButton_clicked()
{
int row = selectedRow();
if (row == -1)
return;
download(librariesModel->get()[row]);
}
示例15: allocateBuffer
PixelBox GL3PlusHardwarePixelBuffer::lockImpl( const Image::Box &lockBox, LockOptions options )
{
//Allocate memory for the entire image, as the buffer
//maynot be freed and be reused in subsequent calls.
allocateBuffer( PixelUtil::getMemorySize( mWidth, mHeight, mDepth, mFormat ) );
mBuffer = PixelBox( lockBox.getWidth(), lockBox.getHeight(),
lockBox.getDepth(), mFormat, mBuffer.data );
mCurrentLock = mBuffer;
mCurrentLock.left = lockBox.left;
mCurrentLock.right += lockBox.left;
mCurrentLock.top = lockBox.top;
mCurrentLock.bottom += lockBox.top;
if(options != HardwareBuffer::HBL_DISCARD)
{
// Download the old contents of the texture
download( mCurrentLock );
}
mCurrentLockOptions = options;
mLockedBox = lockBox;
mCurrentLock = mBuffer;
return mBuffer;
}