本文整理汇总了C++中bfs::path::stem方法的典型用法代码示例。如果您正苦于以下问题:C++ path::stem方法的具体用法?C++ path::stem怎么用?C++ path::stem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bfs::path
的用法示例。
在下文中一共展示了path::stem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetStem
std::string GetStem(const bfs::path& path) {
#if defined(USE_BOOST_FILESYSTEM_V3)
if (!HasExtension(path)) {
// if no extension return empty string
return "";
}
else {
return path.stem().string();
}
#else
if (!HasExtension(path)) {
// if no extension, return empty string
return "";
}
else {
return path.stem();
}
#endif
}
示例2: 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);
}