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


C++ Path_t::generic_string方法代码示例

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


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

示例1:

_tstring rab::GenericString( Path_t const& p )
{
#ifdef SCARAB_WCHAR_MODE
	return p.generic_wstring();
#else
	return p.generic_string();
#endif
}
开发者ID:WildGenie,项目名称:Scarab,代码行数:8,代码来源:rollaball.cpp

示例2: CreateDiffFile

bool rab::CreateDiffFile( Options const& options, DiffEncoders const &diffEncoders, FileInfo& fileInfo, 
	Path_t const& fullNew, Path_t const& fullOld, Path_t const& relativeTemp, 
	dung::MemoryBlock const& newFile, dung::MemoryBlock const& oldFile, PackageOutput_t &package, LogOutput_t& out )
{
	Path_t fullTemp = relativeTemp.filename();

	if( options.produceTemp )
	{
		fullTemp = options.pathToTemp / relativeTemp;
		fs::create_directories( fullTemp.parent_path() );
	}

	dung::DiffEncoder_i* pEncoder = diffEncoders.FindEncoder( fileInfo.name, fileInfo.diffMethod );
	if( pEncoder != NULL )
	{		
		out << "Encoding " << fileInfo.diffMethod << " diff file " << GenericString( relativeTemp ) << std::endl;
		
		dung::MemoryBlock deltaFile;
		if( !pEncoder->EncodeDiffMemoryBlock( newFile.pBlock, newFile.size, oldFile.pBlock, oldFile.size, deltaFile.pBlock, deltaFile.size ) )
		{
			_tstring errorMessage;
			pEncoder->GetErrorMessage( errorMessage );
			out << "Encoding error: " << errorMessage << std::endl;
			return false;
		}

		if( options.produceTemp )
		{
			if( !WriteWholeFile( fullTemp.wstring(), deltaFile ) )
			{
				out << "Can't write file " << GenericString( fullTemp ) << std::endl;
				return false;
			}
		}

		if( !package.WriteFile( GenericString( relativeTemp ), deltaFile.pBlock, deltaFile.size ) )
		{
			out << "Can't write file " << GenericString( relativeTemp ) << " to package. Size=" << deltaFile.size << std::endl;
			return false;
		}
	}
	else
	{
		dung::DiffEncoderExternal_i* pExternalEncoder = diffEncoders.FindExternalEncoder( fileInfo.name, fileInfo.diffMethod );
		if( pExternalEncoder != NULL )
		{
			out << "Encoding " << fileInfo.diffMethod << " diff file " << GenericString( relativeTemp ) << std::endl;
			if( !pExternalEncoder->EncodeDiffFile( GenericString(fullNew).c_str(), GenericString(fullOld).c_str(), GenericString(fullTemp).c_str() ) )
			{
				_tstring errorMessage;
				pExternalEncoder->GetErrorMessage( errorMessage );
				out << "Encoding error: " << errorMessage << std::endl;
				return false;
			}

			dung::MemoryBlock deltaFile;
			if( !ReadWholeFile( fullTemp.generic_string(), deltaFile ) )
			{
				out << "Can't read file " << GenericString(fullTemp) << std::endl;
				return false;
			}

			if( !options.produceTemp )
				fs::remove( fullTemp );

			if( !package.WriteFile( GenericString(relativeTemp), deltaFile.pBlock, deltaFile.size ) )
			{
				out << "Can't write file " << GenericString(relativeTemp) << " to package. Size=" << deltaFile.size << std::endl;
				return false;
			}
		}
		else
		{
			out << "Can't file encoder for file " << fileInfo.name << std::endl;
			return false;
		}				
	}

	return true;
}
开发者ID:WildGenie,项目名称:Scarab,代码行数:80,代码来源:filediff.cpp


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