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


C++ path::stem方法代码示例

本文整理汇总了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
 }
开发者ID:fifengine,项目名称:fifengine,代码行数:19,代码来源:fife_boost_filesystem.cpp

示例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);
}
开发者ID:jesserobertson,项目名称:blob-extractor,代码行数:52,代码来源:crawler.cpp


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