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

Function is_root_separator

src/path.cpp:470–495  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

468 // is_root_separator ---------------------------------------------------------------//
469
470 bool is_root_separator(const string_type & str, size_type pos)
471 // pos is position of the separator
472 {
473 BOOST_ASSERT_MSG(!str.empty() && is_separator(str[pos]),
474 "precondition violation");
475
476 // subsequent logic expects pos to be for leftmost slash of a set
477 while (pos > 0 && is_separator(str[pos-1]))
478 --pos;
479
480 // "/" [...]
481 if (pos == 0)
482 return true;
483
484# ifdef BOOST_WINDOWS_API
485 // "c:/" [...]
486 if (pos == 2 && is_letter(str[0]) && str[1] == colon)
487 return true;
488# endif
489
490 // "//" name "/"
491 if (pos < 3 || !is_separator(str[0]) || !is_separator(str[1]))
492 return false;
493
494 return str.find_first_of(separators, 2) == pos;
495 }
496
497 // filename_pos --------------------------------------------------------------------//
498

Callers 3

filenameMethod · 0.85

Calls 2

is_separatorFunction · 0.85
is_letterFunction · 0.85

Tested by

no test coverage detected