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


C++ Shared::getDefaultExtension方法代码示例

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


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

示例1: SaveToFile

CC_FILE_ERROR FileIOFilter::SaveToFile(	ccHObject* entities,
										const QString& filename,
										SaveParameters& parameters,
										Shared filter)
{
	if (!entities || filename.isEmpty() || !filter)
		return CC_FERR_BAD_ARGUMENT;

	//if the file name has no extension, we had a default one!
	QString completeFileName(filename);
	if (QFileInfo(filename).suffix().isEmpty())
		completeFileName += QString(".%1").arg(filter->getDefaultExtension());

	CC_FILE_ERROR result = CC_FERR_NO_ERROR;
	try
	{
		result = filter->saveToFile(entities, completeFileName, parameters);
	}
	catch(...)
	{
		ccLog::Warning(QString("[I/O] CC has caught an unhandled exception while saving file '%1'").arg(filename));
		result = CC_FERR_CONSOLE_ERROR;
	}

	if (result == CC_FERR_NO_ERROR)
	{
		ccLog::Print(QString("[I/O] File '%1' saved successfully").arg(filename));
	}
	else
	{
		DisplayErrorMessage(result,"saving",filename);
	}

	return result;
}
开发者ID:,项目名称:,代码行数:35,代码来源:

示例2: Register

void FileIOFilter::Register(Shared filter)
{
	if (!filter)
	{
		assert(false);
		return;
	}

	//filters are uniquely recognized by their 'file filter' string
	QStringList fileFilters = filter->getFileFilters(true);
	QString filterName = filter->getDefaultExtension().toUpper();
	for (FilterContainer::const_iterator it=s_ioFilters.begin(); it!=s_ioFilters.end(); ++it)
	{
		bool error = false;
		if (*it == filter)
		{
			ccLog::Warning(QString("[FileIOFilter::Register] I/O filter '%1' is already registered").arg(filterName));
			error = true;
		}
		else
		{
			//we are going to compare the file filters as they should remain unique!
			QStringList otherFilters = (*it)->getFileFilters(true);
			for (int i=0; i<fileFilters.size(); ++i)
			{
				if (otherFilters.contains(fileFilters[i]))
				{
					QString otherFilterName = (*it)->getDefaultExtension().toUpper();;
					ccLog::Warning(QString("[FileIOFilter::Register] Internal error: file filter '%1' of filter '%2' is already handled by another filter ('%3')!").arg(fileFilters[i]).arg(filterName).arg(otherFilterName));
					error = true;
					break;
				}
			}
		}

		if (error)
			return;
	}

	//insert filter
	s_ioFilters.push_back(filter);
}
开发者ID:norbertwenzel,项目名称:CloudCompare,代码行数:42,代码来源:FileIOFilter.cpp


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