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 {
199 void GetComponents(std::vector<FilePath::StringType>* components) const;
201 // Returns true if this FilePath is a strict parent of the |child|. Absolute
206 bool IsParent(const FilePath& child) const;
216 bool AppendRelativePath(const FilePath& child, FilePath* path) const;
218 // Returns a FilePath corresponding to the directory containing the path
220 // only contains one component, returns a FilePath identifying
222 // returns a FilePath identifying the root directory.
223 FilePath DirName() const WARN_UNUSED_RESULT;
225 // Returns a FilePath corresponding to the last path component of this
227 // the root directory, returns a FilePath identifying the root directory;
229 FilePath BaseName() const WARN_UNUSED_RESULT;
255 FilePath RemoveExtension() const WARN_UNUSED_RESULT;
259 FilePath RemoveFinalExtension() const WARN_UNUSED_RESULT;
268 FilePath InsertBeforeExtension(
270 FilePath InsertBeforeExtensionASCII(
273 // Adds |extension| to |file_name|. Returns the current FilePath if
275 FilePath AddExtension(
282 FilePath ReplaceExtension(
289 // Returns a FilePath by appending a separator and the supplied path
292 // If this object's path is kCurrentDirectory, a new FilePath corresponding
295 FilePath Append(const StringType& component) const WARN_UNUSED_RESULT;
296 FilePath Append(const FilePath& component) const WARN_UNUSED_RESULT;
304 FilePath AppendASCII(const base::StringPiece& component)
307 // Returns true if this FilePath contains an absolute path. On Windows, an
316 // Returns a copy of this FilePath that ends with a trailing separator. If
317 // the input path is empty, an empty FilePath will be returned.
318 FilePath AsEndingWithSeparator() const WARN_UNUSED_RESULT;
320 // Returns a copy of this FilePath that does not end with a trailing
322 FilePath StripTrailingSeparators() const WARN_UNUSED_RESULT;
324 // Returns true if this FilePath contains an attempt to reference a parent
335 // This should only be used for cases where the FilePath is representing a
357 // Returns a FilePath object from a path name in UTF-8. This function
365 static FilePath FromUTF8Unsafe(const std::string& utf8);
368 static FilePath FromUTF16Unsafe(const string16& utf16);
375 FilePath NormalizePathSeparators() const;
379 FilePath NormalizePathSeparatorsTo(CharType separator) const;
406 static StringType GetHFSDecomposedForm(const FilePath::StringType& string);
439 BASE_EXPORT extern void PrintTo(const base::FilePath& path, std::ostream* out);
441 // Macros for string literal initialization of FilePath::CharType[], and for
442 // using a FilePath::CharType[] in a printf-style format string.
453 // Provide a hash function so that hash_sets and maps can contain FilePath
459 struct hash<base::FilePath> {
460 size_t operator()(const base::FilePath& f) const {
461 return hash<base::FilePath::StringType>()(f.value());
467 inline size_t hash_value(const base::FilePath& f) {