本文整理汇总了C++中bfs::path::filename方法的典型用法代码示例。如果您正苦于以下问题:C++ path::filename方法的具体用法?C++ path::filename怎么用?C++ path::filename使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bfs::path
的用法示例。
在下文中一共展示了path::filename方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VideoAssetException
VideoAsset::VideoAsset(bfs::path videoFile, bfs::path path, bool copy) : path(path) {
try {
name = path.filename().string();
if(!bfs::exists(videoFile)) throw VideoAssetException("video File doesn't exist!");
if(!bfs::exists(path) || !bfs::is_directory(path)) throw VideoAssetException("Destination folder doesn't exist");
if(copy) {
video_path = path;
video_path /= videoFile.filename();
bfs::copy_file(videoFile, video_path, bfs::copy_option::overwrite_if_exists);
} else video_path = videoFile;
isExternal = !copy;
loadPlayerSync();
writeInfoFile();
hasTimetable = false;
hasShotBoundaries = false;
hasHistograms = false;
hasMeans = false;
isReady = false;
} catch (const bfs::filesystem_error& ex) {
(*Tobago.log)(Log::ERROR) << "Error creating video asset " << path.string() << ": " << ex.what();
throw VideoAssetException(ex.what());
}
}
示例2: GetFilenameFromPath
std::string GetFilenameFromPath(const bfs::path& path) {
#if defined(USE_BOOST_FILESYSTEM_V3)
// boost version 1.46 and above uses
// boost filesystem version 3 as the default
// which has yet a different way of getting
// a filename string
return path.filename().string();
#elif defined(USE_NON_DEPRECATED_BOOST_FILESYSTEM_V2)
// the new way in boost filesystem version 2
// to get a filename string
//(this is for boost version 1.36 and above)
return path.filename();
#else
// the old way in boost filesystem version 2
// to get a filename string
//(this is for boost version 1.35 and below)
return path.leaf();
#endif
}
示例3: analyse_image
// Analysis routine
void Crawler::analyse_image(const bfs::path& path)
{
std::ostringstream msg;
msg << "Running image analysis on " << path;
logger->message(msg.str(), traceLevel);
// Construct and segment picture
std::auto_ptr<ImageAnalyst> \
analyst(new ImageAnalyst(bfs::absolute(path.filename()),
analyst_settings));
analyst->segment();
// Get centroids and dump to file if required
if (settings.output) {
std::ostringstream msg;
msg << "Dumping segment centroids to " << settings.outputfile;
logger->message(msg.str(), traceLevel);
// Get segmentation window size
blitz::TinyVector<int, 4> wsize = analyst->get_window_size();
// Open dumpfile as stream, add path, altered path and image and
// window sizes
std::fstream dumpFileStream;
dumpFileStream.open(settings.outputfile.string().c_str(),
std::fstream::out | std::fstream::app);
dumpFileStream << "{'original_file': '" << path.string()
<< "', 'segmented_file': '"
<< path.stem() << "_segments" << bfs::extension(path)
<< "', 'image_size': ("
<< analyst->columns() << ", " << analyst->rows()
<< "), 'window_size': (" << wsize[0] << ", "
<< wsize[1] << ", " << wsize[2] << ", "
<< wsize[3] << "), ";
// Get centroids, push to file
std::vector<Index> centroids;
analyst->get_centroids(centroids);
dumpFileStream << "'centroids': [";
foreach(Index index, centroids)
dumpFileStream << "(" << index[0] << "," << index[1] << "), ";
dumpFileStream << "]}" << std::endl;
// Clean up
dumpFileStream.flush();
dumpFileStream.close();
}
// Exit
logger->message("Done!", traceLevel);
}
示例4: operator
// Operator for given path
void Crawler::operator()(const bfs::path& path) {
// Check argument type: only directories or regex-matched files allowed
if (bfs::is_directory(path)) {
std::ostringstream msg;
msg << "Traversing " << path;
logger->message(msg.str(), traceLevel);
for(bfs::directory_iterator it(path), end; it != end; it++) {
// Traverse directory: First check whether path points to a directory,
// and call function recursively if recurse flag is set. Otherwise
// path points to a file, so call function recursively on it.
if (bfs::is_directory(it->path()) && not(settings.recursive)) {
_ignore_message(it->path());
continue;
}
(*this)(it->path());
}
} else if (_match_regex(path.filename()))
analyse_image(path);
else _ignore_message(path);
}