Lines Matching refs:style

42   inline Style real_style(Style style) {  in real_style()  argument
43 if (style != Style::native) in real_style()
44 return style; in real_style()
45 if (is_style_posix(style)) in real_style()
51 inline const char *separators(Style style) { in separators() argument
52 if (is_style_windows(style)) in separators()
57 inline char preferred_separator(Style style) { in preferred_separator() argument
58 if (real_style(style) == Style::windows) in preferred_separator()
63 StringRef find_first_component(StringRef path, Style style) { in find_first_component() argument
73 if (is_style_windows(style)) { in find_first_component()
81 if ((path.size() > 2) && is_separator(path[0], style) && in find_first_component()
82 path[0] == path[1] && !is_separator(path[2], style)) { in find_first_component()
84 size_t end = path.find_first_of(separators(style), 2); in find_first_component()
89 if (is_separator(path[0], style)) in find_first_component()
93 size_t end = path.find_first_of(separators(style)); in find_first_component()
99 size_t filename_pos(StringRef str, Style style) { in filename_pos() argument
100 if (str.size() > 0 && is_separator(str[str.size() - 1], style)) in filename_pos()
103 size_t pos = str.find_last_of(separators(style), str.size() - 1); in filename_pos()
105 if (is_style_windows(style)) { in filename_pos()
110 if (pos == StringRef::npos || (pos == 1 && is_separator(str[0], style))) in filename_pos()
118 size_t root_dir_start(StringRef str, Style style) { in root_dir_start() argument
120 if (is_style_windows(style)) { in root_dir_start()
121 if (str.size() > 2 && str[1] == ':' && is_separator(str[2], style)) in root_dir_start()
126 if (str.size() > 3 && is_separator(str[0], style) && str[0] == str[1] && in root_dir_start()
127 !is_separator(str[2], style)) { in root_dir_start()
128 return str.find_first_of(separators(style), 2); in root_dir_start()
132 if (str.size() > 0 && is_separator(str[0], style)) in root_dir_start()
141 size_t parent_path_end(StringRef path, Style style) { in parent_path_end() argument
142 size_t end_pos = filename_pos(path, style); in parent_path_end()
145 path.size() > 0 && is_separator(path[end_pos], style); in parent_path_end()
148 size_t root_dir_pos = root_dir_start(path, style); in parent_path_end()
151 is_separator(path[end_pos - 1], style)) in parent_path_end()
228 const_iterator begin(StringRef path, Style style) { in begin() argument
231 i.Component = find_first_component(path, style); in begin()
233 i.S = style; in begin()
299 reverse_iterator rbegin(StringRef Path, Style style) { in rbegin() argument
303 I.S = style; in rbegin()
350 StringRef root_path(StringRef path, Style style) { in root_path() argument
351 const_iterator b = begin(path, style), pos = b, e = end(path); in root_path()
354 b->size() > 2 && is_separator((*b)[0], style) && (*b)[1] == (*b)[0]; in root_path()
355 bool has_drive = is_style_windows(style) && b->ends_with(":"); in root_path()
358 if ((++pos != e) && is_separator((*pos)[0], style)) { in root_path()
367 if (is_separator((*b)[0], style)) { in root_path()
375 StringRef root_name(StringRef path, Style style) { in root_name() argument
376 const_iterator b = begin(path, style), e = end(path); in root_name()
379 b->size() > 2 && is_separator((*b)[0], style) && (*b)[1] == (*b)[0]; in root_name()
380 bool has_drive = is_style_windows(style) && b->ends_with(":"); in root_name()
392 StringRef root_directory(StringRef path, Style style) { in root_directory() argument
393 const_iterator b = begin(path, style), pos = b, e = end(path); in root_directory()
396 b->size() > 2 && is_separator((*b)[0], style) && (*b)[1] == (*b)[0]; in root_directory()
397 bool has_drive = is_style_windows(style) && b->ends_with(":"); in root_directory()
401 (++pos != e) && is_separator((*pos)[0], style)) { in root_directory()
406 if (!has_net && is_separator((*b)[0], style)) { in root_directory()
415 StringRef relative_path(StringRef path, Style style) { in relative_path() argument
416 StringRef root = root_path(path, style); in relative_path()
420 void append(SmallVectorImpl<char> &path, Style style, const Twine &a, in append() argument
435 !path.empty() && is_separator(path[path.size() - 1], style); in append()
438 size_t loc = component.find_first_not_of(separators(style)); in append()
447 !component.empty() && is_separator(component[0], style); in append()
449 !(path.empty() || has_root_name(component, style))) { in append()
451 path.push_back(preferred_separator(style)); in append()
464 const_iterator end, Style style) { in append() argument
466 path::append(path, style, *begin); in append()
469 StringRef parent_path(StringRef path, Style style) { in parent_path() argument
470 size_t end_pos = parent_path_end(path, style); in parent_path()
476 void remove_filename(SmallVectorImpl<char> &path, Style style) { in remove_filename() argument
477 size_t end_pos = parent_path_end(StringRef(path.begin(), path.size()), style); in remove_filename()
483 Style style) { in replace_extension() argument
490 if (pos != StringRef::npos && pos >= filename_pos(p, style)) in replace_extension()
502 Style style = Style::native) { in starts_with() argument
504 if (is_style_windows(style)) { in starts_with()
508 bool SepPath = is_separator(Path[I], style); in starts_with()
509 bool SepPrefix = is_separator(Prefix[I], style); in starts_with()
521 StringRef NewPrefix, Style style) { in replace_path_prefix() argument
526 if (!starts_with(OrigPath, OldPrefix, style)) in replace_path_prefix()
542 void native(const Twine &path, SmallVectorImpl<char> &result, Style style) { in native() argument
549 native(result, style); in native()
552 void native(SmallVectorImpl<char> &Path, Style style) { in native() argument
555 if (is_style_windows(style)) { in native()
557 if (is_separator(Ch, style)) in native()
558 Ch = preferred_separator(style); in native()
559 if (Path[0] == '~' && (Path.size() == 1 || is_separator(Path[1], style))) { in native()
570 std::string convert_to_slash(StringRef path, Style style) { in convert_to_slash() argument
571 if (is_style_posix(style)) in convert_to_slash()
579 StringRef filename(StringRef path, Style style) { return *rbegin(path, style); } in filename() argument
581 StringRef stem(StringRef path, Style style) { in stem() argument
582 StringRef fname = filename(path, style); in stem()
592 StringRef extension(StringRef path, Style style) { in extension() argument
593 StringRef fname = filename(path, style); in extension()
603 bool is_separator(char value, Style style) { in is_separator() argument
606 if (is_style_windows(style)) in is_separator()
611 StringRef get_separator(Style style) { in get_separator() argument
612 if (real_style(style) == Style::windows) in get_separator()
617 bool has_root_name(const Twine &path, Style style) { in has_root_name() argument
621 return !root_name(p, style).empty(); in has_root_name()
624 bool has_root_directory(const Twine &path, Style style) { in has_root_directory() argument
628 return !root_directory(p, style).empty(); in has_root_directory()
631 bool has_root_path(const Twine &path, Style style) { in has_root_path() argument
635 return !root_path(p, style).empty(); in has_root_path()
638 bool has_relative_path(const Twine &path, Style style) { in has_relative_path() argument
642 return !relative_path(p, style).empty(); in has_relative_path()
645 bool has_filename(const Twine &path, Style style) { in has_filename() argument
649 return !filename(p, style).empty(); in has_filename()
652 bool has_parent_path(const Twine &path, Style style) { in has_parent_path() argument
656 return !parent_path(p, style).empty(); in has_parent_path()
659 bool has_stem(const Twine &path, Style style) { in has_stem() argument
663 return !stem(p, style).empty(); in has_stem()
666 bool has_extension(const Twine &path, Style style) { in has_extension() argument
670 return !extension(p, style).empty(); in has_extension()
673 bool is_absolute(const Twine &path, Style style) { in is_absolute() argument
677 bool rootDir = has_root_directory(p, style); in is_absolute()
678 bool rootName = is_style_posix(style) || has_root_name(p, style); in is_absolute()
683 bool is_absolute_gnu(const Twine &path, Style style) { in is_absolute_gnu() argument
689 if (!p.empty() && is_separator(p.front(), style)) in is_absolute_gnu()
692 if (is_style_windows(style)) { in is_absolute_gnu()
701 bool is_relative(const Twine &path, Style style) { in is_relative() argument
702 return !is_absolute(path, style); in is_relative()
705 StringRef remove_leading_dotslash(StringRef Path, Style style) { in remove_leading_dotslash() argument
707 while (Path.size() > 2 && Path[0] == '.' && is_separator(Path[1], style)) { in remove_leading_dotslash()
709 while (Path.size() > 0 && is_separator(Path[0], style)) in remove_leading_dotslash()
718 Style style) { in remove_dots() argument
719 style = real_style(style); in remove_dots()
725 StringRef root = path::root_path(remaining, style); in remove_dots()
733 size_t next_slash = remaining.find_first_of(separators(style)); in remove_dots()
741 needs_change |= remaining.front() != preferred_separator(style); in remove_dots()
767 make_preferred(buffer, style); in remove_dots()
777 buffer += preferred_separator(style); in remove_dots()