Lines Matching refs:style

41   inline Style real_style(Style style) {  in real_style()  argument
42 if (style != Style::native) in real_style()
43 return style; in real_style()
44 if (is_style_posix(style)) in real_style()
50 inline const char *separators(Style style) { in separators() argument
51 if (is_style_windows(style)) in separators()
56 inline char preferred_separator(Style style) { in preferred_separator() argument
57 if (real_style(style) == Style::windows) in preferred_separator()
62 StringRef find_first_component(StringRef path, Style style) { in find_first_component() argument
72 if (is_style_windows(style)) { in find_first_component()
80 if ((path.size() > 2) && is_separator(path[0], style) && in find_first_component()
81 path[0] == path[1] && !is_separator(path[2], style)) { in find_first_component()
83 size_t end = path.find_first_of(separators(style), 2); in find_first_component()
88 if (is_separator(path[0], style)) in find_first_component()
92 size_t end = path.find_first_of(separators(style)); in find_first_component()
98 size_t filename_pos(StringRef str, Style style) { in filename_pos() argument
99 if (str.size() > 0 && is_separator(str[str.size() - 1], style)) in filename_pos()
102 size_t pos = str.find_last_of(separators(style), str.size() - 1); in filename_pos()
104 if (is_style_windows(style)) { in filename_pos()
109 if (pos == StringRef::npos || (pos == 1 && is_separator(str[0], style))) in filename_pos()
117 size_t root_dir_start(StringRef str, Style style) { in root_dir_start() argument
119 if (is_style_windows(style)) { in root_dir_start()
120 if (str.size() > 2 && str[1] == ':' && is_separator(str[2], style)) in root_dir_start()
125 if (str.size() > 3 && is_separator(str[0], style) && str[0] == str[1] && in root_dir_start()
126 !is_separator(str[2], style)) { in root_dir_start()
127 return str.find_first_of(separators(style), 2); in root_dir_start()
131 if (str.size() > 0 && is_separator(str[0], style)) in root_dir_start()
140 size_t parent_path_end(StringRef path, Style style) { in parent_path_end() argument
141 size_t end_pos = filename_pos(path, style); in parent_path_end()
144 path.size() > 0 && is_separator(path[end_pos], style); in parent_path_end()
147 size_t root_dir_pos = root_dir_start(path, style); in parent_path_end()
150 is_separator(path[end_pos - 1], style)) in parent_path_end()
227 const_iterator begin(StringRef path, Style style) { in begin() argument
230 i.Component = find_first_component(path, style); in begin()
232 i.S = style; in begin()
298 reverse_iterator rbegin(StringRef Path, Style style) { in rbegin() argument
302 I.S = style; in rbegin()
349 StringRef root_path(StringRef path, Style style) { in root_path() argument
350 const_iterator b = begin(path, style), pos = b, e = end(path); in root_path()
353 b->size() > 2 && is_separator((*b)[0], style) && (*b)[1] == (*b)[0]; in root_path()
354 bool has_drive = is_style_windows(style) && b->ends_with(":"); in root_path()
357 if ((++pos != e) && is_separator((*pos)[0], style)) { in root_path()
366 if (is_separator((*b)[0], style)) { in root_path()
374 StringRef root_name(StringRef path, Style style) { in root_name() argument
375 const_iterator b = begin(path, style), e = end(path); in root_name()
378 b->size() > 2 && is_separator((*b)[0], style) && (*b)[1] == (*b)[0]; in root_name()
379 bool has_drive = is_style_windows(style) && b->ends_with(":"); in root_name()
391 StringRef root_directory(StringRef path, Style style) { in root_directory() argument
392 const_iterator b = begin(path, style), pos = b, e = end(path); in root_directory()
395 b->size() > 2 && is_separator((*b)[0], style) && (*b)[1] == (*b)[0]; in root_directory()
396 bool has_drive = is_style_windows(style) && b->ends_with(":"); in root_directory()
400 (++pos != e) && is_separator((*pos)[0], style)) { in root_directory()
405 if (!has_net && is_separator((*b)[0], style)) { in root_directory()
414 StringRef relative_path(StringRef path, Style style) { in relative_path() argument
415 StringRef root = root_path(path, style); in relative_path()
419 void append(SmallVectorImpl<char> &path, Style style, const Twine &a, in append() argument
434 !path.empty() && is_separator(path[path.size() - 1], style); in append()
437 size_t loc = component.find_first_not_of(separators(style)); in append()
446 !component.empty() && is_separator(component[0], style); in append()
448 !(path.empty() || has_root_name(component, style))) { in append()
450 path.push_back(preferred_separator(style)); in append()
463 const_iterator end, Style style) { in append() argument
465 path::append(path, style, *begin); in append()
468 StringRef parent_path(StringRef path, Style style) { in parent_path() argument
469 size_t end_pos = parent_path_end(path, style); in parent_path()
475 void remove_filename(SmallVectorImpl<char> &path, Style style) { in remove_filename() argument
476 size_t end_pos = parent_path_end(StringRef(path.begin(), path.size()), style); in remove_filename()
482 Style style) { in replace_extension() argument
489 if (pos != StringRef::npos && pos >= filename_pos(p, style)) in replace_extension()
501 Style style = Style::native) { in starts_with() argument
503 if (is_style_windows(style)) { in starts_with()
507 bool SepPath = is_separator(Path[I], style); in starts_with()
508 bool SepPrefix = is_separator(Prefix[I], style); in starts_with()
520 StringRef NewPrefix, Style style) { in replace_path_prefix() argument
525 if (!starts_with(OrigPath, OldPrefix, style)) in replace_path_prefix()
541 void native(const Twine &path, SmallVectorImpl<char> &result, Style style) { in native() argument
548 native(result, style); in native()
551 void native(SmallVectorImpl<char> &Path, Style style) { in native() argument
554 if (is_style_windows(style)) { in native()
556 if (is_separator(Ch, style)) in native()
557 Ch = preferred_separator(style); in native()
558 if (Path[0] == '~' && (Path.size() == 1 || is_separator(Path[1], style))) { in native()
569 std::string convert_to_slash(StringRef path, Style style) { in convert_to_slash() argument
570 if (is_style_posix(style)) in convert_to_slash()
578 StringRef filename(StringRef path, Style style) { return *rbegin(path, style); } in filename() argument
580 StringRef stem(StringRef path, Style style) { in stem() argument
581 StringRef fname = filename(path, style); in stem()
591 StringRef extension(StringRef path, Style style) { in extension() argument
592 StringRef fname = filename(path, style); in extension()
602 bool is_separator(char value, Style style) { in is_separator() argument
605 if (is_style_windows(style)) in is_separator()
610 StringRef get_separator(Style style) { in get_separator() argument
611 if (real_style(style) == Style::windows) in get_separator()
616 bool has_root_name(const Twine &path, Style style) { in has_root_name() argument
620 return !root_name(p, style).empty(); in has_root_name()
623 bool has_root_directory(const Twine &path, Style style) { in has_root_directory() argument
627 return !root_directory(p, style).empty(); in has_root_directory()
630 bool has_root_path(const Twine &path, Style style) { in has_root_path() argument
634 return !root_path(p, style).empty(); in has_root_path()
637 bool has_relative_path(const Twine &path, Style style) { in has_relative_path() argument
641 return !relative_path(p, style).empty(); in has_relative_path()
644 bool has_filename(const Twine &path, Style style) { in has_filename() argument
648 return !filename(p, style).empty(); in has_filename()
651 bool has_parent_path(const Twine &path, Style style) { in has_parent_path() argument
655 return !parent_path(p, style).empty(); in has_parent_path()
658 bool has_stem(const Twine &path, Style style) { in has_stem() argument
662 return !stem(p, style).empty(); in has_stem()
665 bool has_extension(const Twine &path, Style style) { in has_extension() argument
669 return !extension(p, style).empty(); in has_extension()
672 bool is_absolute(const Twine &path, Style style) { in is_absolute() argument
676 bool rootDir = has_root_directory(p, style); in is_absolute()
677 bool rootName = is_style_posix(style) || has_root_name(p, style); in is_absolute()
682 bool is_absolute_gnu(const Twine &path, Style style) { in is_absolute_gnu() argument
688 if (!p.empty() && is_separator(p.front(), style)) in is_absolute_gnu()
691 if (is_style_windows(style)) { in is_absolute_gnu()
700 bool is_relative(const Twine &path, Style style) { in is_relative() argument
701 return !is_absolute(path, style); in is_relative()
704 StringRef remove_leading_dotslash(StringRef Path, Style style) { in remove_leading_dotslash() argument
706 while (Path.size() > 2 && Path[0] == '.' && is_separator(Path[1], style)) { in remove_leading_dotslash()
708 while (Path.size() > 0 && is_separator(Path[0], style)) in remove_leading_dotslash()
717 Style style) { in remove_dots() argument
718 style = real_style(style); in remove_dots()
724 StringRef root = path::root_path(remaining, style); in remove_dots()
732 size_t next_slash = remaining.find_first_of(separators(style)); in remove_dots()
740 needs_change |= remaining.front() != preferred_separator(style); in remove_dots()
766 make_preferred(buffer, style); in remove_dots()
776 buffer += preferred_separator(style); in remove_dots()