Lines Matching defs:style

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