MCPcopy Create free account
hub / github.com/boostorg/filesystem / recursive_directory_iterator_construct

Function recursive_directory_iterator_construct

src/directory.cpp:1332–1376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1330//--------------------------------------------------------------------------------------//
1331
1332BOOST_FILESYSTEM_DECL
1333void recursive_directory_iterator_construct(recursive_directory_iterator& it, path const& dir_path, directory_options opts, system::error_code* ec)
1334{
1335 // At most one of the two options may be specified
1336 BOOST_ASSERT((opts & (directory_options::follow_directory_symlink | directory_options::_detail_no_follow)) != (directory_options::follow_directory_symlink | directory_options::_detail_no_follow));
1337
1338 if (ec)
1339 ec->clear();
1340
1341 directory_iterator dir_it;
1342 detail::directory_iterator_construct(dir_it, dir_path, opts, nullptr, ec);
1343 if ((ec && *ec) || dir_it == directory_iterator())
1344 return;
1345
1346 boost::intrusive_ptr< detail::recur_dir_itr_imp > imp;
1347 if (!ec)
1348 {
1349 imp = new detail::recur_dir_itr_imp(opts);
1350 }
1351 else
1352 {
1353 imp = new (std::nothrow) detail::recur_dir_itr_imp(opts);
1354 if (BOOST_UNLIKELY(!imp))
1355 {
1356 *ec = make_error_code(system::errc::not_enough_memory);
1357 return;
1358 }
1359 }
1360
1361 try
1362 {
1363 imp->m_stack.push_back(std::move(dir_it));
1364 it.m_imp.swap(imp);
1365 }
1366 catch (std::bad_alloc&)
1367 {
1368 if (ec)
1369 {
1370 *ec = make_error_code(system::errc::not_enough_memory);
1371 return;
1372 }
1373
1374 throw;
1375 }
1376}
1377
1378namespace {
1379

Callers 1

Calls 4

directory_iteratorClass · 0.85
clearMethod · 0.80
swapMethod · 0.80

Tested by

no test coverage detected