本文整理汇总了C++中bfs::path::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ path::empty方法的具体用法?C++ path::empty怎么用?C++ path::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bfs::path
的用法示例。
在下文中一共展示了path::empty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: openBamFile
void BamReaderPool::openBamFile(const bfs::path& file) {
if (file.empty()) {
throw BamReaderPoolException("No BAM file specified.");
}
std::lock_guard<std::mutex> lock(poolmtx_); // GUARD
closeBamFile_nolock();
if (!open_) {
// try to open all readers
for (BamTools::BamReader& reader : readers_) {
if (!reader.Open(file.c_str())) {
throw BamReaderPoolException(
"Unable to open BAM file " + file.string() + ":\n\t"
+ reader.GetErrorString());
}
}
// try to open index
for (BamTools::BamReader& reader : readers_) {
if (!reader.LocateIndex()) {
throw BamReaderPoolException(
"Unable to open BAM index file " + file.string() + ":\n\t"
+ reader.GetErrorString());
}
}
// all are open, now push them onto the queue
for (BamTools::BamReader& reader : readers_) {
pushReader(reader);
}
file_ = file;
open_ = true;
} else {
throw BamReaderPoolException("Failed to close BAM reader pool.");
}
}
示例2: 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());
}
示例3: request_new_project_path
bfs::path request_new_project_path( bfs::path default_path )
{
if( default_path.empty() )
default_path = path::DEFAULT_PROJECTS_DIR;
return bfs::path( QFileDialog::getExistingDirectory( nullptr
, QObject::tr("New AOS Designer Project Location")
, QString::fromStdString( default_path.string() )
).toStdString() );
}
示例4: request_project_path
bfs::path request_project_path( bfs::path default_path )
{
if( default_path.empty() )
default_path = path::DEFAULT_PROJECTS_DIR;
return bfs::path( QFileDialog::getOpenFileName( nullptr
, QObject::tr( "Open AOS Designer Project" )
, QString::fromStdString( default_path.string() )
, QObject::tr( "AOS Designer Project (*.aosp)" )
).toStdString() );
}
示例5: Path
/**
* @brief Dumps class data to the file.
*
* Method dumps class data to the file in the same format as input file has.
*
* @param filePath Path of the file to create (empty means overwrite input file).
*/
void condor2nav::CFileParserINI::Dump(const bfs::path &filePath /* = "" */) const
{
COStream ostream{filePath.empty() ? Path() : filePath};
// dump global scope
for(const auto &v : _valuesMap)
ostream << v.first << "=" << v.second << std::endl;
// dump chapters
for(auto it=_chaptersList.begin(); it!=_chaptersList.end(); ++it) {
if(it != _chaptersList.begin() || _valuesMap.size())
ostream << std::endl;
ostream << "[" << it->name << "]" << std::endl;
for(const auto &v : it->valuesMap)
ostream << v.first << "=" << v.second << std::endl;
}
}
示例6: while
/**
* @brief Creates specified directory
*
* Function creates given directory recursively.
*
* @param dirName Directory name to created.
*
* @exception std::runtime_error Operation did not succeed
*/
void condor2nav::DirectoryCreate(const bfs::path &dirName)
{
bool activeSync = false;
const std::string str = dirName.string();
if(str.size() > 2 && str[0] == '\\' && str[1] != '\\')
activeSync = true;
if(!dirName.empty()) {
if(!activeSync) {
bfs::create_directories(dirName);
}
else {
auto path = dirName;
std::vector<bfs::path> dirs;
while(path.parent_path() != "\\") {
dirs.emplace_back(path);
path = path.parent_path();
}
auto &activeSync = CActiveSync::Instance();
std::for_each(dirs.crbegin(), dirs.crend(),
[&](const bfs::path &d){ activeSync.DirectoryCreate(d); });
}
}
}