本文整理汇总了C++中DataPtr::getFilename方法的典型用法代码示例。如果您正苦于以下问题:C++ DataPtr::getFilename方法的具体用法?C++ DataPtr::getFilename怎么用?C++ DataPtr::getFilename使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataPtr
的用法示例。
在下文中一共展示了DataPtr::getFilename方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deleteFiles
void DataManagerImpl::deleteFiles(DataPtr data, QString basePath)
{
if (!data)
return;
ImagePtr image = boost::dynamic_pointer_cast<Image>(data);
QStringList files;
if (!data->getFilename().isEmpty())
{
files << QDir(basePath).absoluteFilePath(data->getFilename());
if (image)
files << changeExtension(files[0], "raw");
}
for (int i=0; i<files.size(); ++i)
{
if (!QFileInfo(files[i]).exists())
continue;
report(QString("Removing %1 from disk").arg(files[i]));
QFile(files[i]).remove();
}
}
示例2: loadData
DataPtr DataManagerImpl::loadData(QDomElement node, QString rootPath)
{
QString uid = node.toElement().attribute("uid");
QString name = node.toElement().attribute("name");
QString type = node.toElement().attribute("type");
QDir relativePath = this->findRelativePath(node, rootPath);
QString absolutePath = this->findAbsolutePath(relativePath, rootPath);
if (mData.count(uid)) // dont load same image twice
return mData[uid];
DataPtr data = mDataFactory->create(type, uid, name);
if (!data)
{
reportWarning(QString("Unknown type: %1 for file %2").arg(type).arg(absolutePath));
return DataPtr();
}
bool loaded = data->load(absolutePath);
if (!loaded)
{
reportWarning("Unknown file: " + absolutePath);
return DataPtr();
}
if (!name.isEmpty())
data->setName(name);
data->setFilename(relativePath.path());
this->loadData(data);
// conversion for change in format 2013-10-29
QString newPath = rootPath+"/"+data->getFilename();
if (QDir::cleanPath(absolutePath) != QDir::cleanPath(newPath))
{
reportWarning(QString("Detected old data format, converting from %1 to %2").arg(absolutePath).arg(newPath));
data->save(rootPath);
}
return data;
}