本文整理汇总了C++中fs::path::branch_path方法的典型用法代码示例。如果您正苦于以下问题:C++ path::branch_path方法的具体用法?C++ path::branch_path怎么用?C++ path::branch_path使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fs::path
的用法示例。
在下文中一共展示了path::branch_path方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create_path
void bcp_implementation::create_path(const fs::path& p)
{
if(!fs::exists(m_dest_path / p))
{
// recurse then create the path:
create_path(p.branch_path());
fs::create_directory(m_dest_path / p);
}
}
示例2: copy_path
void bcp_implementation::copy_path(const fs::path& p)
{
assert(!fs::is_directory(m_boost_path / p));
if(fs::exists(m_dest_path / p))
{
std::cout << "Copying (and overwriting) file: " << p.string() << "\n";
fs::remove(m_dest_path / p);
}
else
std::cout << "Copying file: " << p.string() << "\n";
//
// create the path to the new file if it doesn't already exist:
//
create_path(p.branch_path());
//
// do text based copy if requested:
//
if(p.leaf() == "Jamroot")
{
static std::vector<char> v1, v2;
v1.clear();
v2.clear();
std::ifstream is((m_boost_path / p).c_str());
std::copy(std::istreambuf_iterator<char>(is), std::istreambuf_iterator<char>(), std::back_inserter(v1));
static boost::regex libname_matcher;
if(libname_matcher.empty())
{
libname_matcher.assign("boost_");
}
regex_replace(std::back_inserter(v2), v1.begin(), v1.end(), libname_matcher, m_namespace_name + "_");
std::swap(v1, v2);
v2.clear();
std::ofstream os;
if(m_unix_lines)
os.open((m_dest_path / p).c_str(), std::ios_base::binary | std::ios_base::out);
else
os.open((m_dest_path / p).c_str(), std::ios_base::out);
os.write(&*v1.begin(), v1.size());
os.close();
}
else if(m_namespace_name.size() && m_lib_names.size() && is_jam_file(p))
{
static std::vector<char> v1, v2;
v1.clear();
v2.clear();
std::ifstream is((m_boost_path / p).c_str());
std::copy(std::istreambuf_iterator<char>(is), std::istreambuf_iterator<char>(), std::back_inserter(v1));
static boost::regex libname_matcher;
if(libname_matcher.empty())
{
std::string re = "\\<";
re += *m_lib_names.begin();
for(std::set<std::string>::const_iterator i = ++m_lib_names.begin(); i != m_lib_names.end(); ++i)
{
re += "|" + *i;
}
re += "\\>";
libname_matcher.assign(re);
}
regex_replace(std::back_inserter(v2), v1.begin(), v1.end(), libname_matcher, get_new_library_name(m_namespace_name));
std::swap(v1, v2);
v2.clear();
std::ofstream os;
if(m_unix_lines)
os.open((m_dest_path / p).c_str(), std::ios_base::binary | std::ios_base::out);
else
os.open((m_dest_path / p).c_str(), std::ios_base::out);
os.write(&*v1.begin(), v1.size());
os.close();
}
else if(m_namespace_name.size() && is_source_file(p))
{
//
// v1 hold the current content, v2 is temp buffer.
// Each time we do a search and replace the new content
// ends up in v2: we then swap v1 and v2, and clear v2.
//
static std::vector<char> v1, v2;
v1.clear();
v2.clear();
std::ifstream is((m_boost_path / p).c_str());
std::copy(std::istreambuf_iterator<char>(is), std::istreambuf_iterator<char>(), std::back_inserter(v1));
static const boost::regex namespace_matcher(
"(?|"
"(namespace\\s+)boost(_\\w+)?(?:(\\s*::\\s*)phoenix)?"
"|"
"(namespace\\s+)(adstl|phoenix|rapidxml)\\>"
"|"
"()\\<boost((?:_(?!intrusive_tags)\\w+)?\\s*(?:::))(?:(\\s*)phoenix)?"
"|"
"()\\<((?:adstl|phoenix|rapidxml)\\s*(?:::))"
"|"
"(namespace\\s+\\w+\\s*=\\s*(?:::\\s*)?)boost(_\\w+)?(?:(\\s*::\\s*)phoenix)?"
//.........这里部分代码省略.........