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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 path_ = that.path_; | 116 path_ = that.path_; |
117 return *this; | 117 return *this; |
118 } | 118 } |
119 | 119 |
120 bool operator==(const FilePath& that) const { | 120 bool operator==(const FilePath& that) const { |
121 return path_ == that.path_; | 121 return path_ == that.path_; |
122 } | 122 } |
123 | 123 |
124 const StringType& value() const { return path_; } | 124 const StringType& value() const { return path_; } |
125 | 125 |
| 126 // Returns true if |character| is in kSeparators. |
| 127 static bool IsSeparator(CharType character); |
| 128 |
126 // Returns a FilePath corresponding to the directory containing the path | 129 // Returns a FilePath corresponding to the directory containing the path |
127 // named by this object, stripping away the file component. If this object | 130 // named by this object, stripping away the file component. If this object |
128 // only contains one component, returns a FilePath identifying | 131 // only contains one component, returns a FilePath identifying |
129 // kCurrentDirectory. If this object already refers to the root directory, | 132 // kCurrentDirectory. If this object already refers to the root directory, |
130 // returns a FilePath identifying the root directory. | 133 // returns a FilePath identifying the root directory. |
131 FilePath DirName() const; | 134 FilePath DirName() const; |
132 | 135 |
133 // Returns a FilePath corresponding to the last path component of this | 136 // Returns a FilePath corresponding to the last path component of this |
134 // object, either a file or a directory. If this object already refers to | 137 // object, either a file or a directory. If this object already refers to |
135 // the root directory, returns a FilePath identifying the root directory; | 138 // the root directory, returns a FilePath identifying the root directory; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 }; | 186 }; |
184 | 187 |
185 // Macros for string literal initialization of FilePath::CharType[]. | 188 // Macros for string literal initialization of FilePath::CharType[]. |
186 #if defined(OS_POSIX) | 189 #if defined(OS_POSIX) |
187 #define FILE_PATH_LITERAL(x) x | 190 #define FILE_PATH_LITERAL(x) x |
188 #elif defined(OS_WIN) | 191 #elif defined(OS_WIN) |
189 #define FILE_PATH_LITERAL(x) L ## x | 192 #define FILE_PATH_LITERAL(x) L ## x |
190 #endif // OS_WIN | 193 #endif // OS_WIN |
191 | 194 |
192 #endif // BASE_FILE_PATH_H_ | 195 #endif // BASE_FILE_PATH_H_ |
OLD | NEW |