OLD | NEW |
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // FilePath is a container for pathnames stored in a platform's native string | 5 // FilePath is a container for pathnames stored in a platform's native string |
6 // type, providing containers for manipulation in according with the | 6 // type, providing containers for manipulation in according with the |
7 // platform's conventions for pathnames. It supports the following path | 7 // platform's conventions for pathnames. It supports the following path |
8 // types: | 8 // types: |
9 // | 9 // |
10 // POSIX Windows | 10 // POSIX Windows |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 109 |
110 FilePath() {} | 110 FilePath() {} |
111 FilePath(const FilePath& that) : path_(that.path_) {} | 111 FilePath(const FilePath& that) : path_(that.path_) {} |
112 explicit FilePath(const StringType& path) : path_(path) {} | 112 explicit FilePath(const StringType& path) : path_(path) {} |
113 | 113 |
114 FilePath& operator=(const FilePath& that) { | 114 FilePath& operator=(const FilePath& that) { |
115 path_ = that.path_; | 115 path_ = that.path_; |
116 return *this; | 116 return *this; |
117 } | 117 } |
118 | 118 |
| 119 bool operator==(const FilePath& that) const { |
| 120 return path_ == that.path_; |
| 121 } |
| 122 |
119 const StringType& value() const { return path_; } | 123 const StringType& value() const { return path_; } |
120 | 124 |
121 // Returns a FilePath corresponding to the directory containing the path | 125 // Returns a FilePath corresponding to the directory containing the path |
122 // named by this object, stripping away the file component. If this object | 126 // named by this object, stripping away the file component. If this object |
123 // only contains one component, returns a FilePath identifying | 127 // only contains one component, returns a FilePath identifying |
124 // kCurrentDirectory. If this object already refers to the root directory, | 128 // kCurrentDirectory. If this object already refers to the root directory, |
125 // returns a FilePath identifying the root directory. | 129 // returns a FilePath identifying the root directory. |
126 FilePath DirName() const; | 130 FilePath DirName() const; |
127 | 131 |
128 // Returns a FilePath corresponding to the last path component of this | 132 // Returns a FilePath corresponding to the last path component of this |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 }; | 182 }; |
179 | 183 |
180 // Macros for string literal initialization of FilePath::CharType[]. | 184 // Macros for string literal initialization of FilePath::CharType[]. |
181 #if defined(OS_POSIX) | 185 #if defined(OS_POSIX) |
182 #define FILE_PATH_LITERAL(x) x | 186 #define FILE_PATH_LITERAL(x) x |
183 #elif defined(OS_WIN) | 187 #elif defined(OS_WIN) |
184 #define FILE_PATH_LITERAL(x) L ## x | 188 #define FILE_PATH_LITERAL(x) L ## x |
185 #endif // OS_WIN | 189 #endif // OS_WIN |
186 | 190 |
187 #endif // BASE_FILE_PATH_H_ | 191 #endif // BASE_FILE_PATH_H_ |
OLD | NEW |