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

Method append_v4

src/path.cpp:535–593  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

533}
534
535BOOST_FILESYSTEM_DECL void path_algorithms::append_v4(path& p, const value_type* begin, const value_type* end)
536{
537 if (begin != end)
538 {
539 if (BOOST_LIKELY(!is_overlapping(p.m_pathname, begin)))
540 {
541 const size_type that_size = end - begin;
542 size_type that_root_name_size = 0;
543 size_type that_root_dir_pos = find_root_directory_start(begin, that_size, that_root_name_size);
544
545 // if (p.is_absolute())
546 if
547 (
548#if defined(BOOST_FILESYSTEM_WINDOWS_API)
549 that_root_name_size > 0 &&
550#endif
551 that_root_dir_pos < that_size
552 )
553 {
554 return_assign:
555 p.assign(begin, end);
556 return;
557 }
558
559 size_type this_root_name_size = 0;
560 find_root_directory_start(p.m_pathname.c_str(), p.m_pathname.size(), this_root_name_size);
561
562 if
563 (
564 that_root_name_size > 0 &&
565 (that_root_name_size != this_root_name_size || std::memcmp(p.m_pathname.c_str(), begin, this_root_name_size * sizeof(value_type)) != 0)
566 )
567 {
568 goto return_assign;
569 }
570
571 if (that_root_dir_pos < that_size)
572 {
573 // Remove root directory (if any) and relative path to replace with those from p
574 p.m_pathname.erase(p.m_pathname.begin() + this_root_name_size, p.m_pathname.end());
575 }
576
577 const value_type* const that_path = begin + that_root_name_size;
578 if (!detail::is_directory_separator(*that_path))
579 path_algorithms::append_separator_if_needed(p);
580 p.m_pathname.append(that_path, end);
581 }
582 else
583 {
584 // overlapping source
585 string_type rhs(begin, end);
586 path_algorithms::append_v4(p, rhs.data(), rhs.data() + rhs.size());
587 }
588 }
589 else if (path_algorithms::has_filename_v4(p))
590 {
591 p.m_pathname.push_back(path::preferred_separator);
592 }

Callers

nothing calls this directly

Calls 9

is_overlappingFunction · 0.85
is_directory_separatorFunction · 0.85
dataMethod · 0.80
assignMethod · 0.45
c_strMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected