当前位置: 首页>>代码示例>>C++>>正文


C++ Downloader::lastOutputError方法代码示例

本文整理汇总了C++中Downloader::lastOutputError方法的典型用法代码示例。如果您正苦于以下问题:C++ Downloader::lastOutputError方法的具体用法?C++ Downloader::lastOutputError怎么用?C++ Downloader::lastOutputError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Downloader的用法示例。


在下文中一共展示了Downloader::lastOutputError方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: performNetworkOperation

NetworkResult NetworkFactory::performNetworkOperation(const QString &url, int timeout, const QByteArray &input_data,
                                         const QString &input_content_type, QByteArray &output,
                                         QNetworkAccessManager::Operation operation, bool protected_contents,
                                         const QString &username, const QString &password, bool set_basic_header) {
  Downloader downloader;
  QEventLoop loop;
  NetworkResult result;

  QString str(input_data);

  downloader.appendRawHeader("Content-Type", input_content_type.toLocal8Bit());

  if (set_basic_header) {
    QString basic_value = username + ":" + password;
    QString header_value = QString("Basic ") + QString(basic_value.toUtf8().toBase64());

    downloader.appendRawHeader("Authorization", header_value.toLocal8Bit());
  }

  // We need to quit event loop when the download finishes.
  QObject::connect(&downloader, SIGNAL(completed(QNetworkReply::NetworkError)), &loop, SLOT(quit()));

  downloader.manipulateData(url, operation, input_data, timeout, protected_contents, username, password);
  loop.exec();
  output = downloader.lastOutputData();
  result.first = downloader.lastOutputError();
  result.second = downloader.lastContentType();

  return result;
}
开发者ID:keinkurt,项目名称:rssguard,代码行数:30,代码来源:networkfactory.cpp

示例2: downloadFeedFile

NetworkResult NetworkFactory::downloadFeedFile(const QString &url, int timeout,
                                               QByteArray &output, bool protected_contents,
                                               const QString &username, const QString &password) {
  // Here, we want to achieve "synchronous" approach because we want synchronout download API for
  // some use-cases too.
  Downloader downloader;
  QEventLoop loop;
  NetworkResult result;

  downloader.appendRawHeader("Accept", ACCEPT_HEADER_FOR_FEED_DOWNLOADER);

  // We need to quit event loop when the download finishes.
  QObject::connect(&downloader, SIGNAL(completed(QNetworkReply::NetworkError)), &loop, SLOT(quit()));

  downloader.downloadFile(url, timeout, protected_contents, username, password);
  loop.exec();
  output = downloader.lastOutputData();
  result.first = downloader.lastOutputError();
  result.second = downloader.lastContentType();

  return result;
}
开发者ID:keinkurt,项目名称:rssguard,代码行数:22,代码来源:networkfactory.cpp


注:本文中的Downloader::lastOutputError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。