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.
132 class BASE_EXPORT FilePath {
165 FilePath();
166 FilePath(const FilePath& that);
167 explicit FilePath(const StringType& path);
168 ~FilePath();
169 FilePath& operator=(const FilePath& that);
171 bool operator==(const FilePath& that) const;
173 bool operator!=(const FilePath& that) const;
176 bool operator<(const FilePath& that) const {
192 void GetComponents(std::vector<FilePath::StringType>* components) const;
194 // Returns true if this FilePath is a strict parent of the |child|. Absolute
199 bool IsParent(const FilePath& child) const;
209 bool AppendRelativePath(const FilePath& child, FilePath* path) const;
211 // Returns a FilePath corresponding to the directory containing the path
213 // only contains one component, returns a FilePath identifying
215 // returns a FilePath identifying the root directory.
216 FilePath DirName() const WARN_UNUSED_RESULT;
218 // Returns a FilePath corresponding to the last path component of this
220 // the root directory, returns a FilePath identifying the root directory;
222 FilePath BaseName() const WARN_UNUSED_RESULT;
237 FilePath RemoveExtension() const WARN_UNUSED_RESULT;
246 FilePath InsertBeforeExtension(
248 FilePath InsertBeforeExtensionASCII(
251 // Adds |extension| to |file_name|. Returns the current FilePath if
253 FilePath AddExtension(
260 FilePath ReplaceExtension(
267 // Returns a FilePath by appending a separator and the supplied path
270 // If this object's path is kCurrentDirectory, a new FilePath corresponding
273 FilePath Append(const StringType& component) const WARN_UNUSED_RESULT;
274 FilePath Append(const FilePath& component) const WARN_UNUSED_RESULT;
282 FilePath AppendASCII(const base::StringPiece& component)
285 // Returns true if this FilePath contains an absolute path. On Windows, an
294 // Returns a copy of this FilePath that ends with a trailing separator. If
295 // the input path is empty, an empty FilePath will be returned.
296 FilePath AsEndingWithSeparator() const WARN_UNUSED_RESULT;
298 // Returns a copy of this FilePath that does not end with a trailing
300 FilePath StripTrailingSeparators() const WARN_UNUSED_RESULT;
302 // Returns true if this FilePath contains any attempt to reference a parent
313 // This should only be used for cases where the FilePath is representing a
337 // useful to smooth porting that old code to the FilePath API.
343 // try to convert the API into using FilePath.
351 static FilePath FromWStringHack(const std::wstring& wstring);
353 // Returns a FilePath object from a path name in UTF-8. This function
361 static FilePath FromUTF8Unsafe(const std::string& utf8);
364 static FilePath FromUTF16Unsafe(const string16& utf16);
371 FilePath NormalizePathSeparators() const;
398 static StringType GetHFSDecomposedForm(const FilePath::StringType& string);
422 BASE_EXPORT extern void PrintTo(const base::FilePath& path, std::ostream* out);
424 // Macros for string literal initialization of FilePath::CharType[], and for
425 // using a FilePath::CharType[] in a printf-style format string.
436 // Provide a hash function so that hash_sets and maps can contain FilePath
442 struct hash<base::FilePath> {
443 size_t operator()(const base::FilePath& f) const {
444 return hash<base::FilePath::StringType>()(f.value());
450 inline size_t hash_value(const base::FilePath& f) {