| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 FilePath RemoveExtension() const; | 179 FilePath RemoveExtension() const; |
| 180 | 180 |
| 181 // Inserts |suffix| after the file name portion of |path| but before the | 181 // Inserts |suffix| after the file name portion of |path| but before the |
| 182 // extension. Returns "" if BaseName() == "." or "..". | 182 // extension. Returns "" if BaseName() == "." or "..". |
| 183 // Examples: | 183 // Examples: |
| 184 // path == "C:\pics\jojo.jpg" suffix == " (1)", returns "C:\pics\jojo (1).jpg" | 184 // path == "C:\pics\jojo.jpg" suffix == " (1)", returns "C:\pics\jojo (1).jpg" |
| 185 // path == "jojo.jpg" suffix == " (1)", returns "jojo (1).jpg" | 185 // path == "jojo.jpg" suffix == " (1)", returns "jojo (1).jpg" |
| 186 // path == "C:\pics\jojo" suffix == " (1)", returns "C:\pics\jojo (1)" | 186 // path == "C:\pics\jojo" suffix == " (1)", returns "C:\pics\jojo (1)" |
| 187 // path == "C:\pics.old\jojo" suffix == " (1)", returns "C:\pics.old\jojo (1)" | 187 // path == "C:\pics.old\jojo" suffix == " (1)", returns "C:\pics.old\jojo (1)" |
| 188 FilePath InsertBeforeExtension(const StringType& suffix) const; | 188 FilePath InsertBeforeExtension(const StringType& suffix) const; |
| 189 FilePath InsertBeforeExtensionASCII(const StringPiece& suffix) const; |
| 189 | 190 |
| 190 // Replaces the extension of |file_name| with |extension|. If |file_name| | 191 // Replaces the extension of |file_name| with |extension|. If |file_name| |
| 191 // does not have an extension, them |extension| is added. If |extension| is | 192 // does not have an extension, them |extension| is added. If |extension| is |
| 192 // empty, then the extension is removed from |file_name|. | 193 // empty, then the extension is removed from |file_name|. |
| 193 // Returns "" if BaseName() == "." or "..". | 194 // Returns "" if BaseName() == "." or "..". |
| 194 FilePath ReplaceExtension(const StringType& extension) const; | 195 FilePath ReplaceExtension(const StringType& extension) const; |
| 195 | 196 |
| 196 // Returns true if the file path matches the specified extension. The test is | 197 // Returns true if the file path matches the specified extension. The test is |
| 197 // case insensitive. Don't forget the leading period if appropriate. | 198 // case insensitive. Don't forget the leading period if appropriate. |
| 198 bool MatchesExtension(const StringType& extension) const; | 199 bool MatchesExtension(const StringType& extension) const; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 namespace stdext { | 273 namespace stdext { |
| 273 | 274 |
| 274 inline size_t hash_value(const FilePath& f) { | 275 inline size_t hash_value(const FilePath& f) { |
| 275 return hash_value(f.value()); | 276 return hash_value(f.value()); |
| 276 } | 277 } |
| 277 | 278 |
| 278 } // namespace stdext | 279 } // namespace stdext |
| 279 #endif // COMPILER | 280 #endif // COMPILER |
| 280 | 281 |
| 281 #endif // BASE_FILE_PATH_H_ | 282 #endif // BASE_FILE_PATH_H_ |
| OLD | NEW |