本文整理汇总了C++中Exporter::saveDataSet方法的典型用法代码示例。如果您正苦于以下问题:C++ Exporter::saveDataSet方法的具体用法?C++ Exporter::saveDataSet怎么用?C++ Exporter::saveDataSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Exporter
的用法示例。
在下文中一共展示了Exporter::saveDataSet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveTask
void AsyncLoader::saveTask(FileEvent *event, DataSetPackage *package)
{
_currentEvent = event;
QString path = event->path();
if (event->IsOnlineNode())
path = _odm->getLocalPath(path);
QString tempPath = path + QString(".tmp");
try
{
int maxSleepTime = 2000;
int sleepTime = 100;
int delay = 0;
while (package->isReady() == false)
{
if (delay > maxSleepTime)
break;
Utils::sleep(sleepTime);
delay += sleepTime;
}
Exporter *exporter = event->getExporter();
if (exporter)
{
exporter->saveDataSet(fq(tempPath), package, boost::bind(&AsyncLoader::progressHandler, this, _1, _2));
} else {
throw runtime_error("No Exporter found!");
}
if ( ! Utils::renameOverwrite(fq(tempPath), fq(path)))
throw runtime_error("File '" + fq(path) + "' is being used by another application.");
if (event->IsOnlineNode())
QMetaObject::invokeMethod(_odm, "beginUploadFile", Qt::AutoConnection, Q_ARG(QString, event->path()), Q_ARG(QString, "asyncloader"), Q_ARG(QString, tq(package->id)), Q_ARG(QString, tq(package->initalMD5)));
else
event->setComplete();
}
catch (runtime_error e)
{
Utils::removeFile(fq(tempPath));
event->setComplete(false, e.what());
}
catch (exception e)
{
Utils::removeFile(fq(tempPath));
event->setComplete(false, e.what());
}
}