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


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

本文整理汇总了C++中boost::filesystem::path::stem方法的典型用法代码示例。如果您正苦于以下问题:C++ path::stem方法的具体用法?C++ path::stem怎么用?C++ path::stem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在boost::filesystem::path的用法示例。


在下文中一共展示了path::stem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: create_directories

void create_directories(const boost::filesystem::path & cur, 
						      boost::filesystem::path & work,
							  boost::filesystem::path & out)
{
	auto parent = cur.parent_path();
	auto start  = parent.begin();

	for(auto p = config::tests.begin(); p != config::tests.end() && *p == *start; ++p, ++start) ;

	work = config::cache;
	out  = config::data;

	for(; start != parent.end(); ++start)
	{
		work /= *start;
		out  /= *start;
		boost::filesystem::create_directory(work);
		boost::filesystem::create_directory(out);
	}

	work /= cur.stem();
	out  /= (cur.stem().native() + ".out");

	boost::filesystem::create_directory(work);
}
开发者ID:pdJeeves,项目名称:MCell-Test-Framework,代码行数:25,代码来源:main.cpp

示例2: initLocal

bool Client::initLocal( const int argc, char** argv )
{
    if( _impl->name.empty() && argc > 0 && argv )
    {
        const boost::filesystem::path prog = argv[0];
        setName( prog.stem().string( ));
    }

    const auto options = _getProgramOptions();
    arg::variables_map vm;
    try
    {
        Strings args;
        for( int i = 0; i < argc; ++i )
            if( strcmp( argv[i], "--" ) != 0 )
                args.push_back( argv[i] );

        arg::store( arg::command_line_parser( args )
                        .options( options ).allow_unregistered().run(), vm );
        arg::notify( vm );
    }
    catch( const std::exception& e )
    {
        LBERROR << "Error in argument parsing: " << e.what() << std::endl;
        return false;
    }

    const bool isClient = vm.count( "eq-client" );
    std::string clientOpts;

    if( vm.count( "eq-layout" ))
        _impl->activeLayouts.push_back( vm["eq-layout"].as< std::string >( ));
    if( vm.count( "eq-gpufilter" ))
        _impl->gpuFilter = vm["eq-gpufilter"].as< std::string >();
    if( vm.count( "eq-modelunit" ))
        _impl->modelUnit = vm["eq-modelunit"].as< float >();

    LBVERB << "Launching " << getNodeID() << std::endl;
    if( !Super::initLocal( argc, argv ))
        return false;

    if( isClient )
    {
        LBVERB << "Client node started from command line with option "
               << clientOpts << std::endl;

        if( !_setupClient( clientOpts ))
        {
            exitLocal();
            return false;
        }

        _impl->running = true;
        clientLoop();
        exitClient();
    }

    _impl->initQt( argc, argv );
    return true;
}
开发者ID:tribal-tec,项目名称:Equalizer,代码行数:60,代码来源:client.cpp

示例3: initLocal

bool Client::initLocal( const int argc, char** argv )
{
    bool isClient = false;
    std::string clientOpts;

    if( _impl->name.empty() && argc > 0 && argv )
    {
        const boost::filesystem::path prog = argv[0];
        setName( prog.stem().string( ));
    }

    for( int i=1; i<argc; ++i )
    {
        if( std::string( "--eq-client" ) == argv[i] )
            isClient = true;
        else if( _isParameterOption( "--eq-layout", argc, argv, i ))
            _impl->activeLayouts.push_back( argv[++i] );
        else if( _isParameterOption( "--eq-gpufilter" , argc, argv, i ))
            _impl->gpuFilter = argv[ ++i ];
        else if( _isParameterOption( "--eq-modelunit", argc, argv, i ))
        {
            std::istringstream unitString( argv[++i] );
            unitString >> _impl->modelUnit;
        }
    }
开发者ID:weetgo,项目名称:Equalizer,代码行数:25,代码来源:client.cpp

示例4: try_run_file

void try_run_file(const boost::filesystem::path & cur)
{
	if(cur.extension().native().compare(".py"))
	{
		return;
	}

	script_file_parser script_file(cur.native());

	if(script_file.is_valid())
	{
		boost::filesystem::path work, out;
		create_directories(cur, work, out);

		auto parent = cur.parent_path();
		auto start  = parent.begin();

		for(auto p = config::tests.begin(); p != config::tests.end() && *p == *start; ++p, ++start) ;

		for(; start != parent.end(); ++start)
		{
			script_file.add_keyword((*start).native());
		}

		script_file.add_title(cur.stem().native());

		if(config::query->evaluate(script_file))
		{
			script_scheduler()->schedule_file(cur, work, out);
		}
	}
}
开发者ID:pdJeeves,项目名称:MCell-Test-Framework,代码行数:32,代码来源:main.cpp

示例5: ParseException

static std::string
loadFile (boost::property_tree::ptree &config,
          const boost::filesystem::path &file)
{
  boost::filesystem::path extension = file.extension();
  boost::filesystem::path extension2 = file.stem().extension();
  std::string fileName = file.filename().string();
  boost::property_tree::ptree readConfig;

  if (extension2.string() == ".conf") {
    if (extension.string() == ".json") {
      boost::property_tree::read_json (file.string(), readConfig);
    } else if (extension.string() == ".info") {
      boost::property_tree::read_info (file.string(), readConfig);
    } else if (extension.string() == ".ini") {
      boost::property_tree::read_ini (file.string(), readConfig);
    } else if (extension.string() == ".xml") {
      boost::property_tree::read_xml (file.string(), readConfig);
    } else {
      throw ParseException ("Unknonw file format");
    }
  } else {
    throw ParseException ("Unknonw file format");
  }

  mergePropertyTrees (config, readConfig);

  config.put ("configPath", file.parent_path().string() );

  fileName = fileName.substr (0, fileName.size() - extension.string().size() );
  fileName = fileName.substr (0, fileName.size() - extension2.string().size() );

  return fileName;
}
开发者ID:startgeek,项目名称:kurento-media-server,代码行数:34,代码来源:loadConfig.cpp

示例6: parser_filepath

		void parser_filepath(const vrString& filePath, vrString& strParentPath, vrString& strFileName, vrString& strStem, vrString& strExtension)
		{
			const fs::path p1 = filePath;
			strParentPath = p1.parent_path().string();
			strFileName = p1.filename().string();
			strExtension = p1.extension().string();
			strStem = p1.stem().string();
		}
开发者ID:YangchenVR,项目名称:libTools,代码行数:8,代码来源:vrFileSystem.cpp

示例7:

	driver(boost::filesystem::path const& path)
		: name_{path.stem().string()}
		, library_{path.string()}
	{
		new_fn_t new_fn;
		library_.require("k_driver_new", new_fn);
		library_.require("k_driver_free", free_fn);
		impl_ = new_fn();
	}
开发者ID:purpleKarrot,项目名称:Lemonade,代码行数:9,代码来源:driver.hpp

示例8: outStream

    WastConverter(const std::string& outDir, const boost::filesystem::path& path) : outDir_(outDir) {
        baseName_ = path.stem().string();

        SExpr fileExpr = SExprParser::parseFile(path.string());
        for (const SExpr& child : fileExpr.children()) {
            const std::string& firstValue = child[0].value();
            if (firstValue == "module") {
                setCurrentModule(child);
            } else if (firstValue == "assert_invalid") {
                std::ofstream outStream(generateOutFile("invalid"));
                outStream << child[1].toString();
                outStream.close();
            } else if (firstValue == "assert_return_nan") {
                SExpr functionCall = convertInvoke(child[1]);
                SExpr newTest = SExprParser::parseString("if (i32.eq (i32.and () " + functionCall.toString() + ") (nop) (unreachable)");
                mainFunction_.addChild(newTest);
            } else if (firstValue == "assert_return") {
                if (child.children().size() == 2) {
                    SExpr functionCall = convertInvoke(child[1]);

                    mainFunction_.addChild(functionCall);
                } else {
                    std::string compareType = child[2][0].value().substr(0, 3);

                    SExpr functionCall = convertInvoke(child[1]);

                    SExpr newTest = SExprParser::parseString("if (" + compareType + ".eq " + functionCall.toString() + " " + child[2].toString() +") (nop) (unreachable)");
                    mainFunction_.addChild(newTest);
                }
            } else if (firstValue == "assert_trap") {
                SExpr functionCall = convertInvoke(child[1]);

                SExpr mainFunctionWithTrap = mainFunction_;
                mainFunctionWithTrap.addChild(functionCall);

                SExpr result = currentModuleExpr_;
                result.addChild(mainFunctionWithTrap);

                std::ofstream outStream(generateOutFile("trap"));
                outStream << result.toString();
                outStream.close();
            } else if (firstValue == "invoke") {
                SExpr functionCall = convertInvoke(child[1]);

                mainFunction_.addChild(functionCall);
            } else {
                std::cerr << "Can't handle assert " << child.toString() << std::endl;
            }
        }
        SExpr positiveModule = currentModuleExpr_;
        positiveModule.addChild(mainFunction_);

        std::ofstream outStream(generatePositiveOutFile("positive"));
        outStream << positiveModule.toString();
        outStream.close();
    }
开发者ID:WebAssembly,项目名称:wasmint,代码行数:56,代码来源:main.cpp

示例9:

fcppt::string
fcppt::filesystem::stem(
	boost::filesystem::path const &_path
)
{
	return
		fcppt::filesystem::path_to_string(
			_path.stem()
		);
}
开发者ID:vinzenz,项目名称:fcppt,代码行数:10,代码来源:stem.cpp

示例10: Compile

void Compile(bool isRebuild, const slbuild::config::build_conf& bc, fs::path p, std::time_t bin_time)
{
	if(!isRebuild){
		auto src_time=fs::last_write_time(p);
		
		if(bin_time>src_time)return;
	}
	std::string ext=p.extension().string();
	slbuild::utility::replace(ext, ".", "");
	
	auto cc_itr=bc.compilers.find(ext);
	if(cc_itr==bc.compilers.end())return;
	
	std::system((bc.compilers.at(ext)+" -o obj/"+p.stem().string()+"_"+ext+".obj "+inc_and_lib()+" -c "+p.filename().string()).c_str());
}
开发者ID:SiLeader,项目名称:slbuild,代码行数:15,代码来源:commands.cpp

示例11:

py::api::object InterpreterContext::import_file(boost::filesystem::path filename) {
    std::string name = filename.stem().string();

    py::list paths;
    paths.append(filename.parent_path().string());

    auto imp_module = py::import("imp");
    auto module_data = imp_module.attr("find_module")(name, paths);
    return imp_module.attr("load_module")(
               name,
               py::api::object(module_data[0]), // file
               py::api::object(module_data[1]), // pathname
               py::api::object(module_data[2])  // description
           );
}
开发者ID:alexandaday,项目名称:pyland,代码行数:15,代码来源:interpreter_context.cpp

示例12: outputFileInfo

void SystemProcessPath::outputFileInfo( const boost::filesystem::path& rPath )
{
	std::string br = "";
	if(rPath.extension() == ".exe" || rPath.extension() == ".EXE" || rPath.extension() == ".eXE" || rPath.extension() == ".exE" || rPath.extension() == ".eXe" || rPath.extension() == ".Exe")
	{		
		br = rPath.parent_path().string();
		br += "\\";
		br += rPath.stem().string();
		br += rPath.extension().string();	

		char bh[64];
		sprintf_s(bh,"%d",iflag);
		stpath = bh;
		SystemProcessPath::mmmap.insert(std:: make_pair( SystemProcessPath::stpath,std::string(br)));
	}
}
开发者ID:,项目名称:,代码行数:16,代码来源:

示例13: extension

ScriptProperties::ScriptProperties(const boost::filesystem::path &file) {
	if (file.extension() != ".sql") {
		THROW(boost::format("Invalid file extension (should be .sql): %1%") % file.string());
	}

	const std::string stem = file.stem().string();

	const std::string targetDbVersionNum = stem.substr(0, versionLength);

	try {
		targetDbVersion = ::stringToNumber(targetDbVersionNum);
	} HANDLE_RETHROW(boost::format("Script file name should begin with a number (%1% digits): %2%") % size_t(versionLength) % file.string());

	if (stem.size() < (versionLength + 1) || (stem[versionLength] != '_')) {
		THROW(boost::format("Number in a script file name has to begin with an underscore (_): %1%") % file.string());
	}

	name = stem.substr(versionLength + 1);
}
开发者ID:milan11,项目名称:repodbsync,代码行数:19,代码来源:ScriptProperties.cpp

示例14: dirpath

  std::vector<string> getallfilenames(boost::filesystem::path p)
 {
     std::vector<string> filepaths;
     boost::filesystem::directory_iterator end_ptr;      
     boost::filesystem::directory_iterator dir(p);   
     for (;dir != end_ptr; dir++) {
         p = boost::filesystem::path(*dir);
         if(is_directory(p))
         {
             getallfilenames(p);
         }
         else
         {
                 string dirpath(dir->path().parent_path().string() );
                 string filename(p.stem().string());
                 filepaths.push_back(dir->path().string());
         }
     }
     return filepaths;
 }
开发者ID:glocalsaint,项目名称:thesis,代码行数:20,代码来源:hashselection.cpp

示例15: hydrate

model hydrator::hydrate(const boost::filesystem::path& p) const {
    const auto gs(p.generic_string());
    BOOST_LOG_SEV(lg, debug) << "Parsing file: " << gs;
    boost::filesystem::ifstream s(p);

    if (s.fail()) {
        BOOST_LOG_SEV(lg, error) << failed_to_open_file << ": " << gs;
        BOOST_THROW_EXCEPTION(hydration_error(failed_to_open_file + gs));
    }

    try {
        auto r(hydrate(s));
        r.name(p.stem().generic_string());
        BOOST_LOG_SEV(lg, debug) << "Parsed file successfully.";
        return r;
    } catch(boost::exception& e) {
        const auto s(p.generic_string());
        BOOST_LOG_SEV(lg, error) << "Failed to parse file: " << s;
        e << error_in_file(s);
        throw;
    }
}
开发者ID:UHBiocomputation,项目名称:neurite,代码行数:22,代码来源:hydrator.cpp


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