Lines Matching defs:FilePath
5 // FilePath is a container for pathnames stored in a platform's native string
26 // FilePath objects are intended to be used anywhere paths are. An
27 // application may pass FilePath objects around internally, masking the
30 // OpenFile(const FilePath &) function may be made available, allowing all
39 // Several methods are available to perform common operations on a FilePath
42 // to an existing FilePath object (Append). These methods are highly
48 // instances of FilePath objects, and are therefore safe to use on const
51 // To aid in initialization of FilePath objects from string literals, a
58 // Because a FilePath object should not be instantiated at the global scope,
59 // instead, use a FilePath::CharType[] and initialize it with
60 // FILE_PATH_LITERAL. At runtime, a FilePath object can be created from the
63 // | const FilePath::CharType kLogFileName[] = FILE_PATH_LITERAL("log.txt");
66 // | FilePath log_file_path(kLogFileName);
82 // with two leading slashes, but FilePath handles this case properly
83 // in case it ever comes across such a system. FilePath needs this support
94 // equivalent. Since the OS treats these paths specially, FilePath needs
96 // FilePath treats c://, c:\\, //, and \\ all equivalently.
142 class FilePath {
176 FilePath();
177 FilePath(const FilePath& that);
178 explicit FilePath(StringViewType path);
179 ~FilePath();
180 FilePath& operator=(const FilePath& that);
182 // Constructs FilePath with the contents of |that|, which is left in valid but
184 FilePath(FilePath&& that) noexcept;
187 FilePath& operator=(FilePath&& that);
189 bool operator==(const FilePath& that) const;
191 bool operator!=(const FilePath& that) const;
194 bool operator<(const FilePath& that) const { return path_ < that.path_; }
215 void GetComponents(std::vector<FilePath::StringType>* components) const;
217 // Returns true if this FilePath is a strict parent of the |child|. Absolute
222 bool IsParent(const FilePath& child) const;
232 bool AppendRelativePath(const FilePath& child, FilePath* path) const;
234 // Returns a FilePath corresponding to the directory containing the path
236 // only contains one component, returns a FilePath identifying
238 // returns a FilePath identifying the root directory. Please note that this
240 [[nodiscard]] FilePath DirName() const;
242 // Returns a FilePath corresponding to the last path component of this
244 // the root directory, returns a FilePath identifying the root directory;
246 [[nodiscard]] FilePath BaseName() const;
272 [[nodiscard]] FilePath RemoveExtension() const;
276 [[nodiscard]] FilePath RemoveFinalExtension() const;
285 [[nodiscard]] FilePath InsertBeforeExtension(StringViewType suffix) const;
286 [[nodiscard]] FilePath InsertBeforeExtensionASCII(
289 // Adds |extension| to |file_name|. Returns the current FilePath if
291 [[nodiscard]] FilePath AddExtension(StringViewType extension) const;
297 [[nodiscard]] FilePath ReplaceExtension(StringViewType extension) const;
299 // Returns a FilePath by appending a separator and the supplied path
302 // If this object's path is kCurrentDirectory, a new FilePath corresponding
305 [[nodiscard]] FilePath Append(StringViewType component) const;
306 [[nodiscard]] FilePath Append(const FilePath& component) const;
314 [[nodiscard]] FilePath AppendASCII(std::string_view component) const;
316 // Returns true if this FilePath contains an absolute path. On Windows, an
325 // Returns a copy of this FilePath that ends with a trailing separator. If
326 // the input path is empty, an empty FilePath will be returned.
327 [[nodiscard]] FilePath AsEndingWithSeparator() const;
329 // Returns a copy of this FilePath that does not end with a trailing
331 [[nodiscard]] FilePath StripTrailingSeparators() const;
333 // Returns true if this FilePath contains an attempt to reference a parent
344 // This should only be used for cases where the FilePath is representing a
353 FilePath NormalizePathSeparators() const;
357 FilePath NormalizePathSeparatorsTo(CharType separator) const;
372 // Macros for string literal initialization of FilePath::CharType[].
382 struct hash<base::FilePath> {
383 typedef base::FilePath argument_type;
386 return hash<base::FilePath::StringType>()(f.value());