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

Function root_directory_start

src/path.cpp:528–571  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

526 // root_directory_start ------------------------------------------------------------//
527
528 size_type root_directory_start(const string_type & path, size_type size)
529 // return npos if no root_directory found
530 {
531
532# ifdef BOOST_WINDOWS_API
533 // case "c:/"
534 if (size > 2
535 && path[1] == colon
536 && is_separator(path[2])) return 2;
537# endif
538
539 // case "//"
540 if (size == 2
541 && is_separator(path[0])
542 && is_separator(path[1])) return string_type::npos;
543
544# ifdef BOOST_WINDOWS_API
545 // case "\\?\"
546 if (size > 4
547 && is_separator(path[0])
548 && is_separator(path[1])
549 && path[2] == questionmark
550 && is_separator(path[3]))
551 {
552 string_type::size_type pos(path.find_first_of(separators, 4));
553 return pos < size ? pos : string_type::npos;
554 }
555# endif
556
557 // case "//net {/}"
558 if (size > 3
559 && is_separator(path[0])
560 && is_separator(path[1])
561 && !is_separator(path[2]))
562 {
563 string_type::size_type pos(path.find_first_of(separators, 2));
564 return pos < size ? pos : string_type::npos;
565 }
566
567 // case "/"
568 if (size > 0 && is_separator(path[0])) return 0;
569
570 return string_type::npos;
571 }
572
573 // first_element --------------------------------------------------------------------//
574 // sets pos and len of first element, excluding extra separators

Callers 4

root_directoryMethod · 0.85
m_parent_path_endMethod · 0.85
path.cppFile · 0.85

Calls 1

is_separatorFunction · 0.85

Tested by

no test coverage detected