本文整理汇总了C++中Path_t::wstring方法的典型用法代码示例。如果您正苦于以下问题:C++ Path_t::wstring方法的具体用法?C++ Path_t::wstring怎么用?C++ Path_t::wstring使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Path_t
的用法示例。
在下文中一共展示了Path_t::wstring方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FileString
bool rab::GatherSha1Files( Options const& options, Config const& config, Path_t const& relativePath,
FolderInfo::FileInfos_t const& fileInfos, LogOutput_t& out )
{
int errors = 0;
for( FolderInfo::FileInfos_t::const_iterator i = fileInfos.begin(); i != fileInfos.end(); ++i )
{
FileInfo& fileInfo = **i;
Path_t fullOld = options.pathToOld / relativePath / fileInfo.name;
dung::MemoryBlock oldFile;
if( !dung::ReadWholeFile( fullOld.wstring(), oldFile ) )
{
out << "Can't read file " << FileString( fullOld ) << std::endl;
errors++;
continue;
}
dung::SHA1Compute( oldFile.pBlock, oldFile.size, fileInfo.oldSha1 );
fileInfo.oldSize = oldFile.size;
}
return errors == 0;
}
示例2:
_tstring rab::FileString( Path_t const& p )
{
#ifdef SCARAB_WCHAR_MODE
return p.wstring();
#else
return p.string();
#endif
}
示例3: BuildDiffFile
bool rab::BuildDiffFile( Options const& options, Config const& config, DiffEncoders const& diffEncoders,
Path_t const& relativePath, PackageOutput_t& package, LogOutput_t& out, FileInfo& fileInfo )
{
Path_t fullNew = options.pathToNew / relativePath / fileInfo.name;
Path_t fullOld = options.pathToOld / relativePath / fileInfo.name;
Path_t relativeTemp = relativePath / DiffFileName(fileInfo.name, config);
dung::MemoryBlock oldFile;
if( !ReadWholeFile( fullOld.wstring(), oldFile ) )
{
out << "Can't read file " << FileString(fullOld) << std::endl;
return false;
}
dung::SHA1Compute( oldFile.pBlock, oldFile.size, fileInfo.oldSha1 );
fileInfo.oldSize = oldFile.size;
if( MatchName( config.oldSkipChanged_regex, fileInfo.name ) )
return true;
dung::MemoryBlock newFile;
if( !ReadWholeFile( fullNew.wstring(), newFile ) )
{
out << "Can't read file " << FileString(fullNew) << std::endl;
return false;
}
dung::SHA1Compute( newFile.pBlock, newFile.size, fileInfo.newSha1 );
fileInfo.newSize = newFile.size;
bool result = true;
if( fileInfo.newSha1 != fileInfo.oldSha1 )
{
fileInfo.isDifferent = true;
result &= CreateDiffFile( options, diffEncoders, fileInfo, fullNew, fullOld, relativeTemp, newFile, oldFile, package, out );
}
else
fileInfo.isDifferent = false;
return result;
}
示例4: 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;
}