Home | History | Annotate | Download | only in Support

Lines Matching refs:path

1 //===- llvm/Support/Path.h - Path Operating System Concept ------*- C++ -*-===//
10 // This file declares the llvm::sys::path namespace. It is designed after
12 // path class.
25 namespace path {
30 /// @brief Path iterator.
33 /// \a path. The traversal order is as follows:
51 StringRef Path; ///< The entire path.
52 StringRef Component; ///< The current component. Not necessarily in Path.
53 size_t Position; ///< The iterators current position within Path.
55 // An end iterator has Position = Path.size() + 1.
56 friend const_iterator begin(StringRef path);
57 friend const_iterator end(StringRef path);
70 /// @brief Reverse path iterator.
73 /// \a path in reverse order. The traversal order is exactly reversed from that
77 StringRef Path; ///< The entire path.
78 StringRef Component; ///< The current component. Not necessarily in Path.
79 size_t Position; ///< The iterators current position within Path.
81 friend reverse_iterator rbegin(StringRef path);
82 friend reverse_iterator rend(StringRef path);
95 /// @brief Get begin iterator over \a path.
96 /// @param path Input path.
97 /// @returns Iterator initialized with the first component of \a path.
98 const_iterator begin(StringRef path);
100 /// @brief Get end iterator over \a path.
101 /// @param path Input path.
102 /// @returns Iterator initialized to the end of \a path.
103 const_iterator end(StringRef path);
105 /// @brief Get reverse begin iterator over \a path.
106 /// @param path Input path.
107 /// @returns Iterator initialized with the first reverse component of \a path.
108 reverse_iterator rbegin(StringRef path);
110 /// @brief Get reverse end iterator over \a path.
111 /// @param path Input path.
112 /// @returns Iterator initialized to the reverse end of \a path.
113 reverse_iterator rend(StringRef path);
119 /// @brief Remove the last component from \a path unless it is the root dir.
128 /// @param path A path that is modified to not have a file component.
129 void remove_filename(SmallVectorImpl<char> &path);
131 /// @brief Replace the file extension of \a path with \a extension.
139 /// @param path A path that has its extension replaced with \a extension.
143 void replace_extension(SmallVectorImpl<char> &path, const Twine &extension);
145 /// @brief Replace matching path prefix with another path.
154 /// @param Path If \a Path starts with \a OldPrefix modify to instead
156 /// @param OldPrefix The path prefix to strip from \a Path.
157 /// @param NewPrefix The path prefix to replace \a NewPrefix with.
158 void replace_path_prefix(SmallVectorImpl<char> &Path,
162 /// @brief Append to path.
170 /// @param path Set to \a path + \a component.
171 /// @param a The component to be appended to \a path.
172 void append(SmallVectorImpl<char> &path, const Twine &a,
177 /// @brief Append to path.
185 /// @param path Set to \a path + [\a begin, \a end).
188 void append(SmallVectorImpl<char> &path,
195 /// Convert path to the native form. This is used to give paths to users and
199 /// @param path A path that is transformed to native format.
201 void native(const Twine &path, SmallVectorImpl<char> &result);
203 /// Convert path to the native form in place. This is used to give paths to
207 /// @param path A path that is transformed to native format.
208 void native(SmallVectorImpl<char> &path);
222 /// @param path Input path.
223 /// @result The root name of \a path if it has one, otherwise "".
224 StringRef root_name(StringRef path);
234 /// @param path Input path.
235 /// @result The root directory of \a path if it has one, otherwise
237 StringRef root_directory(StringRef path);
239 /// @brief Get root path.
243 /// @param path Input path.
244 /// @result The root path of \a path if it has one, otherwise "".
245 StringRef root_path(StringRef path);
247 /// @brief Get relative path.
255 /// @param path Input path.
256 /// @result The path starting after root_path if one exists, otherwise "".
257 StringRef relative_path(StringRef path);
259 /// @brief Get parent path.
267 /// @param path Input path.
268 /// @result The parent path of \a path if one exists, otherwise "".
269 StringRef parent_path(StringRef path);
280 /// @param path Input path.
281 /// @result The filename part of \a path. This is defined as the last component
282 /// of \a path.
283 StringRef filename(StringRef path);
299 /// @param path Input path.
300 /// @result The stem of \a path.
301 StringRef stem(StringRef path);
307 /// at the end of \a path. Otherwise "".
315 /// @param path Input path.
316 /// @result The extension of \a path.
317 StringRef extension(StringRef path);
319 /// @brief Check whether the given char is a path separator on the host OS.
322 /// @result true if \a value is a path separator character on the host OS
333 /// @param erasedOnReboot Whether to favor a path that is erased on reboot
338 /// @param result Holds the resulting path name.
343 /// @param result Holds the resulting path name.
349 /// Expect the resulting path to be a directory shared with other
351 /// used to append additional directory names to the resulting path. Recommended
354 /// @param Result Holds the resulting path.
355 /// @param Path1 Additional path to be appended to the user's cache directory
356 /// path. "" can be used to append nothing.
357 /// @param Path2 Second additional path to be appended.
358 /// @param Path3 Third additional path to be appended.
359 /// @result True if a cache directory path is set, false otherwise.
367 /// @param path Input path.
368 /// @result True if the path has a root name, false otherwise.
369 bool has_root_name(const Twine &path);
375 /// @param path Input path.
376 /// @result True if the path has a root directory, false otherwise.
377 bool has_root_directory(const Twine &path);
379 /// @brief Has root path?
383 /// @param path Input path.
384 /// @result True if the path has a root path, false otherwise.
385 bool has_root_path(const Twine &path);
387 /// @brief Has relative path?
391 /// @param path Input path.
392 /// @result True if the path has a relative path, false otherwise.
393 bool has_relative_path(const Twine &path);
395 /// @brief Has parent path?
399 /// @param path Input path.
400 /// @result True if the path has a parent path, false otherwise.
401 bool has_parent_path(const Twine &path);
407 /// @param path Input path.
408 /// @result True if the path has a filename, false otherwise.
409 bool has_filename(const Twine &path);
415 /// @param path Input path.
416 /// @result True if the path has a stem, false otherwise.
417 bool has_stem(const Twine &path);
423 /// @param path Input path.
424 /// @result True if the path has a extension, false otherwise.
425 bool has_extension(const Twine &path);
427 /// @brief Is path absolute?
429 /// @param path Input path.
430 /// @result True if the path is absolute, false if it is not.
431 bool is_absolute(const Twine &path);
433 /// @brief Is path relative?
435 /// @param path Input path.
436 /// @result True if the path is relative, false if it is not.
437 bool is_relative(const Twine &path);
441 /// @param path Input path.
442 /// @result The cleaned-up \a path.
443 StringRef remove_leading_dotslash(StringRef path);
445 /// @brief In-place remove any './' and optionally '../' components from a path.
447 /// @param path processed path
450 /// @result True if path was changed
451 bool remove_dots(SmallVectorImpl<char> &path, bool remove_dot_dot = false);
453 } // end namespace path