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


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

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


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

示例1: GetParentPath

 bfs::path GetParentPath(const bfs::path& path) {
     #if defined(USE_BOOST_FILESYSTEM_V3) || defined(USE_NON_DEPRECATED_BOOST_FILESYSTEM_V2)
         return path.parent_path();
     #else
         return path.branch_path();
     #endif
 }
开发者ID:fifengine,项目名称:fifengine,代码行数:7,代码来源:fife_boost_filesystem.cpp

示例2: DirectoryCreate

void condor2nav::Download(const std::string &server, const bfs::path &url, const bfs::path &fileName, unsigned timeout /* = 30 */)
{
  DirectoryCreate(fileName.parent_path());
  bfs::ofstream out{fileName, std::ios_base::out | std::ios_base::binary};
  CIStream in{server, url.generic_string(), timeout};
  out << in;
}
开发者ID:mpusz,项目名称:Condor2Nav,代码行数:7,代码来源:tools.cpp

示例3: find_codedb_path

bfs::path find_codedb_path(const bfs::path& p) {
  if (p.empty()) return p;

  if (bfs::exists(p / ".codedb")) return p / ".codedb";

  return find_codedb_path(p.parent_path());
}
开发者ID:PlastecProfiles,项目名称:CodeDB,代码行数:7,代码来源:codedb.cpp

示例4: find

void find(const bfs::path& cdb_path, const options& opt)
{
    config cfg = load_config(cdb_path / "config");

    const bfs::path cdb_root = cdb_path.parent_path();
    const bfs::path search_root = bfs::initial_path();

    std::size_t prefix_size = 0;
    std::string file_match;
    if(opt.m_options.count("-a") == 0 && search_root != cdb_root)
    {
        file_match = "^" + escape_regex(
            search_root.generic_string().substr(cdb_root.string().size() + 1) + "/") + ".*";
        prefix_size = search_root.string().size() - cdb_root.string().size();
    }

    file_lock lock(cdb_path / "lock");
    lock.lock_sharable();

    const char* find_regex_options =
        opt.m_options.count("-i") ? "i" : "";
    const char* file_regex_options =
        cfg.get_value("nocase-file-match") == "on" ? "i" : "";

    bool trim = cfg.get_value("find-trim-ws") == "on";
    unsigned thread_count = get_thread_count(cfg);
    unsigned buffer_count = get_buffer_count(thread_count);

    for(unsigned i = 0; i != opt.m_args.size(); ++i)
    {
        database_ptr db = open_database(cdb_path / "db");

        std::string pattern = opt.m_args[i];
        if(opt.m_options.count("-v"))
            pattern = escape_regex(pattern);

        mt_search mts(*db, trim, prefix_size, buffer_count);

        auto worker = [&]
        {
            mts.search_db(compile_regex(pattern, 0, find_regex_options),
                          compile_regex(file_match, 0, file_regex_options));
        };

        boost::thread_group workers;
        for(unsigned i = 0; i != thread_count-1; ++i)
            workers.create_thread(worker);

        worker();

        workers.join_all();
    }
}
开发者ID:noj,项目名称:CodeDB,代码行数:53,代码来源:find.cpp


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