本文整理汇总了C++中bfs::path::generic_string方法的典型用法代码示例。如果您正苦于以下问题:C++ path::generic_string方法的具体用法?C++ path::generic_string怎么用?C++ path::generic_string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bfs::path
的用法示例。
在下文中一共展示了path::generic_string方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: item_action
void item_action(const bfs::path& ipath)
{
/* use file_status instead of is_xxx */
bfs::file_status sts=bfs::status(ipath);
/* status_error, file_not_found, regular_file, directory_file,
* symlink_file, block_file, character_file, fifo_file, socket_file,
* type_unknown
*/
if (sts.type()==bfs::regular_file)
{
std::cout<<ipath.generic_string()<<"\t"<<bfs::file_size(ipath)<<std::endl;
}
else if (sts.type()==bfs::directory_file)
{
std::cout<<ipath.generic_string()<<std::endl;
}
else
{
std::cout<<ipath.generic_string()<<std::endl;
}
}
示例3: 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();
}
}
示例4: Parse
/**
* @brief Class constructor.
*
* condor2nav::CFileParserINI class constructor.
*
* @param server The server from which to download the INI file.
* @param url The path on the server to the INI file.
*/
condor2nav::CFileParserINI::CFileParserINI(const std::string &server, const bfs::path &url) :
_filePath{server + url.generic_string()}
{
CIStream inputStream{server, url.generic_string()};
Parse(inputStream);
}