本文整理汇总了C++中fs::path::stem方法的典型用法代码示例。如果您正苦于以下问题:C++ path::stem方法的具体用法?C++ path::stem怎么用?C++ path::stem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fs::path
的用法示例。
在下文中一共展示了path::stem方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: uniquify
fs::path uniquify(const fs::path &dest)
{
std::string ext = dest.extension();
std::string fname = dest.stem();
fs::path parent = dest.parent_path();
unsigned number = 1;
std::string newfname;
fs::path newdest;
boost::smatch match;
if(boost::regex_search(fname, match, uregex)) {
// Matches are indexes into fname, so don't change it while reading values
newfname = match[1];
number = boost::lexical_cast<short>(match[2]);
fname = newfname;
}
do {
newfname = fname + "(" + boost::lexical_cast<std::string>(++number) + ")" + ext;
newdest = parent / newfname;
} while(fs::exists(newdest));
return newdest;
}
示例2: GetFilePath
/*******************************************************************
* Function Name: GetFullImagePath
* Return Type : const fs::path
* Created On : Mar 8, 2014
* Created By : hrushi
* Comments : Returns the corresponding full image path for the given track image
* Arguments :
*******************************************************************/
const fs::path TrackXML::GetFullImagePath( UINT FrameNum ) const
{
const fs::path Parentfldr = GetFilePath().parent_path();
const string FldrName = Parentfldr.stem().string();
string ImgStemName = StringOp<UINT>::GetString(FrameNum, '0', 5);
fs::path FullImgPath = Parentfldr.string() + "/full/" + FldrName + "." + ImgStemName + ".jpeg";
return FullImgPath;
}
示例3: WriteDenied
Save::Save(fs::path const& file, bool binary)
: file_name(file)
, tmp_name(unique_path(file.parent_path()/(file.stem().string() + "_tmp_%%%%" + file.extension().string())))
{
LOG_D("agi/io/save/file") << file;
fp = agi::make_unique<boost::filesystem::ofstream>(tmp_name, binary ? std::ios::binary : std::ios::out);
if (!fp->good()) {
acs::CheckDirWrite(file.parent_path());
acs::CheckFileWrite(file);
throw fs::WriteDenied(tmp_name);
}
}
示例4:
/*******************************************************************
* Function Name: GetTrackFilePath
* Return Type : const fs::path
* Created On : Mar 5, 2014
* Created By : hrushi
* Comments : Get the TrackFile path from the given TrackImage path
* Arguments : const fs::path TrackChipPath
*******************************************************************/
const fs::path TrackXML::GetTrackFilePath( const fs::path fsTrackChipPath)
{
fs::path fsTrackFldrPath = fsTrackChipPath.parent_path().parent_path();
string stemname = fsTrackChipPath.stem().string();
UINT TrackNum, FrameNum;
string VideoBaseName;
GetTrkChipNameParts(stemname, TrackNum, FrameNum, VideoBaseName);
fs::path fsTrackFilePath = fsTrackFldrPath.string() + "/" + VideoBaseName + "_track.xml";
return fsTrackFilePath;
}
示例5: mName
Pano( const fs::path& path )
: mDisplayMode{ ivec2(0,0) }, mName( path.filename().string() )
{
std::string stem = path.stem().string();
std::transform( stem.begin(), stem.end(), stem.begin(), ::toupper );
switch( stem.back() ) {
case 'L': mDisplayMode = ivec2( 0, 0 ); break;
case 'R': mDisplayMode = ivec2( 0, 1 ); break;
case 'T': mDisplayMode = ivec2( 1, 0 ); break;
case 'B': mDisplayMode = ivec2( 1, 1 ); break;
default: break;
}
mLatLong = gl::Texture2d::create( loadImage( path ), gl::Texture2d::Format().wrap( GL_REPEAT ) );
}
示例6:
/*******************************************************************
* Function Name: GiveSegImgPath
* Return Type : const fs::path
* Created On : Aug 21, 2013
* Created By : hrushi
* Comments : For the given image path. It creates a segmentation folder and returns the path where the image could be stored
* Arguments : const fs::path& ImgPath
*******************************************************************/
const fs::path Detect::GiveSegImgPath( const fs::path& iPath, const string Suffix)
{
fs::path SegImgPath;
fs::path SegFldr = iPath.parent_path().string() + "/Seg";
fs::create_directory(SegFldr);
string OutputPath;
OutputPath = SegFldr.parent_path().string() + "/Seg/";
OutputPath += iPath.stem().string() + Suffix;
OutputPath += iPath.extension().string();
SegImgPath = OutputPath;
return SegImgPath;
}
示例7: addFile
void SpriteSheetGeneratorApp::addFile(const fs::path &file)
{
set<string> extensions = { ".png", ".jpg", ".gif", ".tiff", ".tif", ".tga" };
if( fs::exists( file ) )
{
cout << "Checking file: " << file << ", extension: " << file.extension().string() << endl;
if( fs::is_regular_file( file ) && extensions.count(file.extension().string()) )
{
cout << "Adding file: " << file << endl;
Surface img = loadImage( file );
string id = file.stem().string();
mWidestImage = max( img.getWidth(), mWidestImage );
auto sprite = mImagePacker.addImage( id, img );
sprite->setRegistrationPoint( Vec2i( sprite->getWidth() / 2, sprite->getHeight() ) );
}
else if( fs::is_directory( file ) )
{
for( auto iter = fs::directory_iterator( file ); iter != fs::directory_iterator(); ++iter )
{
addFile( *iter );
}
}
}
}
示例8: writeToFile
void writeToFile(fs::path _path)
{
stringstream ss;
if (fileCount < 0){
fileCount = 0;
ss << fileCount;
outFile.open(fs::path(string(BASE_MODEL_PATH)+"/Data"+ss.str()+".bin"), ios::binary);
ss.flush();
}
else if (byteCount > BYTE_LIMIT){
outFile.flush();
outFile.close();
fileCount++;
ss << fileCount;
outFile.open(fs::path(string(BASE_DEST_PATH)+"/Data"+ss.str()+".bin"), ios::binary);
ss.flush();
byteCount = 0;
// close file and open new
}
Header head;
head.id = strToUint64(_path.stem());
idxFile.open(_path, ios::binary);
dataFile.open(_path.parent_path() / (_path.stem()+".data"), ios::binary);
idxFile.seekg(0, ios::beg);
idxFile.read((char*)&head.indexCount, sizeof(unsigned));
idxFile.seekg(4, ios::beg);
dataFile.seekg(0, ios::beg);
dataFile.read((char*)&head.vertexCount, sizeof(unsigned));
dataFile.seekg(4, ios::beg);
indexData = new unsigned[head.indexCount];
vertexData = new ooctools::V4N4[head.vertexCount];
idxFile.read((char*)indexData, sizeof(unsigned)*head.indexCount);
idxFile.close();
dataFile.read((char*)vertexData, sizeof(V4N4)*head.vertexCount);
dataFile.close();
// ------------------------------------
//write to file
outFile.seekp(byteCount, ios::beg);
//writing header-info
outFile.write((char*)&head, sizeof(Header));
outFile.seekp(byteCount+sizeof(Header), ios::beg);
//writing the indices
outFile.write((char*)indexData, head.indexCount*sizeof(unsigned));
outFile.seekp(byteCount + sizeof(Header) + head.indexCount*sizeof(unsigned), ios::beg);
//writing the vertices
outFile.write((char*)vertexData, head.vertexCount*sizeof(V4N4));
byteCount += head.sizeOf();
outFile.flush();
delete[] vertexData;
vertexData = 0;
delete[] indexData;
indexData = 0;
}
示例9: trim
void trim(fs::ofstream & out, fs::path & file, std::vector<std::pair<int, int>> & contents, fs::path ffmpeg_path, std::string ffmpeg_options)
{
if (contents.size() != 0)
{
int i = 0;
int gap = 3;
// trim command
for (auto & elem : contents)
{
out << ffmpeg_path << " -y -ss " << (((elem.first - gap) < 0) ? 0 : elem.first - gap) << " -i \"" << file.string() << "\" -t " << elem.second - elem.first + gap << " -vcodec copy -acodec copy tmp_" + std::to_string(i++) + ".m2ts\n";
}
// concastrate command
// ffmpeg path
out << ffmpeg_path;
for (auto j = 0; j < i; ++j)
{
out << " -i tmp_" << std::to_string(j) << ".m2ts";
}
// ffmpeg commands
out << " -filter_complex \"yadif=0:-1,concat=n=" << std::to_string(i) << ":v=1:a=1\" " << ffmpeg_options << " \"done\\" << file.stem().string() << ".mp4\"\n";
}
else
{
out << ffmpeg_path << " ";
out << " -i \"" << file.string() << "\" -filter_complex \"yadif=0:-1\" " << ffmpeg_options << " \"done\\" << file.stem().string() << ".mp4\"\n";
}
}