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

Method filename_v3

src/path.cpp:817–845  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

815}
816
817BOOST_FILESYSTEM_DECL path path_algorithms::filename_v3(path const& p)
818{
819 const size_type size = p.m_pathname.size();
820 size_type root_name_size = 0;
821 size_type root_dir_pos = find_root_directory_start(p.m_pathname.c_str(), size, root_name_size);
822 size_type filename_size, pos;
823 if (root_dir_pos < size && detail::is_directory_separator(p.m_pathname[size - 1]) && is_root_separator(p.m_pathname, root_dir_pos, size - 1))
824 {
825 // Return root directory
826 pos = root_dir_pos;
827 filename_size = 1u;
828 }
829 else if (root_name_size == size)
830 {
831 // Return root name
832 pos = 0u;
833 filename_size = root_name_size;
834 }
835 else
836 {
837 filename_size = find_filename_size(p.m_pathname, root_name_size, size);
838 pos = size - filename_size;
839 if (filename_size == 0u && pos > root_name_size && detail::is_directory_separator(p.m_pathname[pos - 1]) && !is_root_separator(p.m_pathname, root_dir_pos, pos - 1))
840 return detail::dot_path();
841 }
842
843 const value_type* ptr = p.m_pathname.c_str() + pos;
844 return path(ptr, ptr + filename_size);
845}
846
847BOOST_FILESYSTEM_DECL path_algorithms::string_type::size_type path_algorithms::find_filename_v4_size(path const& p)
848{

Callers

nothing calls this directly

Calls 7

is_directory_separatorFunction · 0.85
is_root_separatorFunction · 0.85
find_filename_sizeFunction · 0.85
pathFunction · 0.50
sizeMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected