/// C:\foo\bar => C:,/,foo,bar
///
class const_iterator {
- StringRef Path; //< The entire path.
- StringRef Component; //< The current component. Not necessarily in Path.
- size_t Position; //< The iterators current position within Path.
+ StringRef Path; ///< The entire path.
+ StringRef Component; ///< The current component. Not necessarily in Path.
+ size_t Position; ///< The iterators current position within Path.
// An end iterator has Position = Path.size() + 1.
- friend const_iterator begin(const StringRef &path);
- friend const_iterator end(const StringRef &path);
+ friend const_iterator begin(StringRef path);
+ friend const_iterator end(StringRef path);
public:
typedef const StringRef value_type;
/// @brief Get begin iterator over \a path.
/// @param path Input path.
/// @returns Iterator initialized with the first component of \a path.
-const_iterator begin(const StringRef &path);
+const_iterator begin(StringRef path);
/// @brief Get end iterator over \a path.
/// @param path Input path.
/// @returns Iterator initialized to the end of \a path.
-const_iterator end(const StringRef &path);
+const_iterator end(StringRef path);
/// @brief Get reverse begin iterator over \a path.
/// @param path Input path.
/// @returns Iterator initialized with the first reverse component of \a path.
-inline reverse_iterator rbegin(const StringRef &path) {
+inline reverse_iterator rbegin(StringRef path) {
return reverse_iterator(end(path));
}
/// @brief Get reverse end iterator over \a path.
/// @param path Input path.
/// @returns Iterator initialized to the reverse end of \a path.
-inline reverse_iterator rend(const StringRef &path) {
+inline reverse_iterator rend(StringRef path) {
return reverse_iterator(begin(path));
}
///
/// @param path Input path.
/// @result The root name of \a path if it has one, otherwise "".
-const StringRef root_name(const StringRef &path);
+const StringRef root_name(StringRef path);
/// @brief Get root directory.
///
/// @param path Input path.
/// @result The root directory of \a path if it has one, otherwise
/// "".
-const StringRef root_directory(const StringRef &path);
-
+const StringRef root_directory(StringRef path);
+
/// @brief Get root path.
///
/// Equivalent to root_name + root_directory.
///
/// @param path Input path.
/// @result The root path of \a path if it has one, otherwise "".
-const StringRef root_path(const StringRef &path);
+const StringRef root_path(StringRef path);
/// @brief Get relative path.
///
///
/// @param path Input path.
/// @result The path starting after root_path if one exists, otherwise "".
-const StringRef relative_path(const StringRef &path);
+const StringRef relative_path(StringRef path);
/// @brief Get parent path.
///
///
/// @param path Input path.
/// @result The parent path of \a path if one exists, otherwise "".
-const StringRef parent_path(const StringRef &path);
+const StringRef parent_path(StringRef path);
/// @brief Get filename.
///
/// @param path Input path.
/// @result The filename part of \a path. This is defined as the last component
/// of \a path.
-const StringRef filename(const StringRef &path);
+const StringRef filename(StringRef path);
/// @brief Get stem.
///
///
/// @param path Input path.
/// @result The stem of \a path.
-const StringRef stem(const StringRef &path);
+const StringRef stem(StringRef path);
/// @brief Get extension.
///
///
/// @param path Input path.
/// @result The extension of \a path.
-const StringRef extension(const StringRef &path);
+const StringRef extension(StringRef path);
+
+/// @brief Check whether the given char is a path separator on the host OS.
+///
+/// @param value a character
+/// @result true if \a value is a path separator character on the host OS
+bool is_separator(char value);
+
+/// @brief Get the typical temporary directory for the system, e.g.,
+/// "/var/tmp" or "C:/TEMP"
+///
+/// @param erasedOnReboot Whether to favor a path that is erased on reboot
+/// rather than one that potentially persists longer. This parameter will be
+/// ignored if the user or system has set the typical environment variable
+/// (e.g., TEMP on Windows, TMPDIR on *nix) to specify a temporary directory.
+///
+/// @param Result Holds the resulting path name.
+void system_temp_directory(bool erasedOnReboot, SmallVectorImpl<char> &result);
/// @brief Has root name?
///