本文整理汇总了C++中fs::path::str方法的典型用法代码示例。如果您正苦于以下问题:C++ path::str方法的具体用法?C++ path::str怎么用?C++ path::str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fs::path
的用法示例。
在下文中一共展示了path::str方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: syntax_error
/// Parses a configuration file.
///
/// \post The tree registered during the construction of this class is updated
/// to contain the values read from the configuration file. If the processing
/// fails, the state of the output tree is undefined.
///
/// \param file The path to the file to process.
///
/// \throw syntax_error If there is any problem processing the file.
void
config::parser::parse(const fs::path& file)
{
try {
lutok::do_file(_pimpl->_state, file.str(), 0, 0, 0);
} catch (const lutok::error& e) {
throw syntax_error(e.what());
}
if (!_pimpl->_syntax_called)
throw syntax_error("No syntax defined (no call to syntax() found)");
}
示例2: database
/// Opens a named on-disk SQLite database.
///
/// \param file The path to the database file to be opened. This does not
/// accept the values "" and ":memory:"; use temporary() and in_memory()
/// instead.
/// \param open_flags The flags to be passed to the open routine.
///
/// \return A file-backed database instance.
///
/// \throw std::bad_alloc If there is not enough memory to open the database.
/// \throw api_error If there is any problem opening the database.
sqlite::database
sqlite::database::open(const fs::path& file, int open_flags)
{
PRE_MSG(!file.str().empty(), "Use database::temporary() instead");
PRE_MSG(file.str() != ":memory:", "Use database::in_memory() instead");
int flags = 0;
if (open_flags & open_readonly) {
flags |= SQLITE_OPEN_READONLY;
open_flags &= ~open_readonly;
}
if (open_flags & open_readwrite) {
flags |= SQLITE_OPEN_READWRITE;
open_flags &= ~open_readwrite;
}
if (open_flags & open_create) {
flags |= SQLITE_OPEN_CREATE;
open_flags &= ~open_create;
}
PRE(open_flags == 0);
return database(impl::safe_open(file.c_str(), flags), true);
}