Lines Matching refs:style

40   inline Style real_style(Style style) {  in real_style()  argument
41 if (style != Style::native) in real_style()
42 return style; in real_style()
43 if (is_style_posix(style)) in real_style()
49 inline const char *separators(Style style) { in separators() argument
50 if (is_style_windows(style)) in separators()
55 inline char preferred_separator(Style style) { in preferred_separator() argument
56 if (real_style(style) == Style::windows) in preferred_separator()
61 StringRef find_first_component(StringRef path, Style style) { in find_first_component() argument
71 if (is_style_windows(style)) { in find_first_component()
79 if ((path.size() > 2) && is_separator(path[0], style) && in find_first_component()
80 path[0] == path[1] && !is_separator(path[2], style)) { in find_first_component()
82 size_t end = path.find_first_of(separators(style), 2); in find_first_component()
87 if (is_separator(path[0], style)) in find_first_component()
91 size_t end = path.find_first_of(separators(style)); in find_first_component()
97 size_t filename_pos(StringRef str, Style style) { in filename_pos() argument
98 if (str.size() > 0 && is_separator(str[str.size() - 1], style)) in filename_pos()
101 size_t pos = str.find_last_of(separators(style), str.size() - 1); in filename_pos()
103 if (is_style_windows(style)) { in filename_pos()
108 if (pos == StringRef::npos || (pos == 1 && is_separator(str[0], style))) in filename_pos()
116 size_t root_dir_start(StringRef str, Style style) { in root_dir_start() argument
118 if (is_style_windows(style)) { in root_dir_start()
119 if (str.size() > 2 && str[1] == ':' && is_separator(str[2], style)) in root_dir_start()
124 if (str.size() > 3 && is_separator(str[0], style) && str[0] == str[1] && in root_dir_start()
125 !is_separator(str[2], style)) { in root_dir_start()
126 return str.find_first_of(separators(style), 2); in root_dir_start()
130 if (str.size() > 0 && is_separator(str[0], style)) in root_dir_start()
139 size_t parent_path_end(StringRef path, Style style) { in parent_path_end() argument
140 size_t end_pos = filename_pos(path, style); in parent_path_end()
143 path.size() > 0 && is_separator(path[end_pos], style); in parent_path_end()
146 size_t root_dir_pos = root_dir_start(path, style); in parent_path_end()
149 is_separator(path[end_pos - 1], style)) in parent_path_end()
226 const_iterator begin(StringRef path, Style style) { in begin() argument
229 i.Component = find_first_component(path, style); in begin()
231 i.S = style; in begin()
297 reverse_iterator rbegin(StringRef Path, Style style) { in rbegin() argument
301 I.S = style; in rbegin()
348 StringRef root_path(StringRef path, Style style) { in root_path() argument
349 const_iterator b = begin(path, style), pos = b, e = end(path); in root_path()
352 b->size() > 2 && is_separator((*b)[0], style) && (*b)[1] == (*b)[0]; in root_path()
353 bool has_drive = is_style_windows(style) && b->endswith(":"); in root_path()
356 if ((++pos != e) && is_separator((*pos)[0], style)) { in root_path()
365 if (is_separator((*b)[0], style)) { in root_path()
373 StringRef root_name(StringRef path, Style style) { in root_name() argument
374 const_iterator b = begin(path, style), e = end(path); in root_name()
377 b->size() > 2 && is_separator((*b)[0], style) && (*b)[1] == (*b)[0]; in root_name()
378 bool has_drive = is_style_windows(style) && b->endswith(":"); in root_name()
390 StringRef root_directory(StringRef path, Style style) { in root_directory() argument
391 const_iterator b = begin(path, style), pos = b, e = end(path); in root_directory()
394 b->size() > 2 && is_separator((*b)[0], style) && (*b)[1] == (*b)[0]; in root_directory()
395 bool has_drive = is_style_windows(style) && b->endswith(":"); in root_directory()
399 (++pos != e) && is_separator((*pos)[0], style)) { in root_directory()
404 if (!has_net && is_separator((*b)[0], style)) { in root_directory()
413 StringRef relative_path(StringRef path, Style style) { in relative_path() argument
414 StringRef root = root_path(path, style); in relative_path()
418 void append(SmallVectorImpl<char> &path, Style style, const Twine &a, in append() argument
433 !path.empty() && is_separator(path[path.size() - 1], style); in append()
436 size_t loc = component.find_first_not_of(separators(style)); in append()
445 !component.empty() && is_separator(component[0], style); in append()
447 !(path.empty() || has_root_name(component, style))) { in append()
449 path.push_back(preferred_separator(style)); in append()
462 const_iterator end, Style style) { in append() argument
464 path::append(path, style, *begin); in append()
467 StringRef parent_path(StringRef path, Style style) { in parent_path() argument
468 size_t end_pos = parent_path_end(path, style); in parent_path()
474 void remove_filename(SmallVectorImpl<char> &path, Style style) { in remove_filename() argument
475 size_t end_pos = parent_path_end(StringRef(path.begin(), path.size()), style); in remove_filename()
481 Style style) { in replace_extension() argument
488 if (pos != StringRef::npos && pos >= filename_pos(p, style)) in replace_extension()
500 Style style = Style::native) { in starts_with() argument
502 if (is_style_windows(style)) { in starts_with()
506 bool SepPath = is_separator(Path[I], style); in starts_with()
507 bool SepPrefix = is_separator(Prefix[I], style); in starts_with()
519 StringRef NewPrefix, Style style) { in replace_path_prefix() argument
524 if (!starts_with(OrigPath, OldPrefix, style)) in replace_path_prefix()
540 void native(const Twine &path, SmallVectorImpl<char> &result, Style style) { in native() argument
547 native(result, style); in native()
550 void native(SmallVectorImpl<char> &Path, Style style) { in native() argument
553 if (is_style_windows(style)) { in native()
555 if (is_separator(Ch, style)) in native()
556 Ch = preferred_separator(style); in native()
557 if (Path[0] == '~' && (Path.size() == 1 || is_separator(Path[1], style))) { in native()
568 std::string convert_to_slash(StringRef path, Style style) { in convert_to_slash() argument
569 if (is_style_posix(style)) in convert_to_slash()
577 StringRef filename(StringRef path, Style style) { return *rbegin(path, style); } in filename() argument
579 StringRef stem(StringRef path, Style style) { in stem() argument
580 StringRef fname = filename(path, style); in stem()
590 StringRef extension(StringRef path, Style style) { in extension() argument
591 StringRef fname = filename(path, style); in extension()
601 bool is_separator(char value, Style style) { in is_separator() argument
604 if (is_style_windows(style)) in is_separator()
609 StringRef get_separator(Style style) { in get_separator() argument
610 if (real_style(style) == Style::windows) in get_separator()
615 bool has_root_name(const Twine &path, Style style) { in has_root_name() argument
619 return !root_name(p, style).empty(); in has_root_name()
622 bool has_root_directory(const Twine &path, Style style) { in has_root_directory() argument
626 return !root_directory(p, style).empty(); in has_root_directory()
629 bool has_root_path(const Twine &path, Style style) { in has_root_path() argument
633 return !root_path(p, style).empty(); in has_root_path()
636 bool has_relative_path(const Twine &path, Style style) { in has_relative_path() argument
640 return !relative_path(p, style).empty(); in has_relative_path()
643 bool has_filename(const Twine &path, Style style) { in has_filename() argument
647 return !filename(p, style).empty(); in has_filename()
650 bool has_parent_path(const Twine &path, Style style) { in has_parent_path() argument
654 return !parent_path(p, style).empty(); in has_parent_path()
657 bool has_stem(const Twine &path, Style style) { in has_stem() argument
661 return !stem(p, style).empty(); in has_stem()
664 bool has_extension(const Twine &path, Style style) { in has_extension() argument
668 return !extension(p, style).empty(); in has_extension()
671 bool is_absolute(const Twine &path, Style style) { in is_absolute() argument
675 bool rootDir = has_root_directory(p, style); in is_absolute()
676 bool rootName = is_style_posix(style) || has_root_name(p, style); in is_absolute()
681 bool is_absolute_gnu(const Twine &path, Style style) { in is_absolute_gnu() argument
687 if (!p.empty() && is_separator(p.front(), style)) in is_absolute_gnu()
690 if (is_style_windows(style)) { in is_absolute_gnu()
699 bool is_relative(const Twine &path, Style style) { in is_relative() argument
700 return !is_absolute(path, style); in is_relative()
703 StringRef remove_leading_dotslash(StringRef Path, Style style) { in remove_leading_dotslash() argument
705 while (Path.size() > 2 && Path[0] == '.' && is_separator(Path[1], style)) { in remove_leading_dotslash()
707 while (Path.size() > 0 && is_separator(Path[0], style)) in remove_leading_dotslash()
716 Style style) { in remove_dots() argument
717 style = real_style(style); in remove_dots()
723 StringRef root = path::root_path(remaining, style); in remove_dots()
731 size_t next_slash = remaining.find_first_of(separators(style)); in remove_dots()
739 needs_change |= remaining.front() != preferred_separator(style); in remove_dots()
765 make_preferred(buffer, style); in remove_dots()
775 buffer += preferred_separator(style); in remove_dots()