Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(540)

Side by Side Diff: base/file_path.h

Issue 172012: Add "bool FilePath::ReferencesParent()" which adds a clean & simple way for... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/file_path.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 // Returns true if this FilePath contains an absolute path. On Windows, an 217 // Returns true if this FilePath contains an absolute path. On Windows, an
218 // absolute path begins with either a drive letter specification followed by 218 // absolute path begins with either a drive letter specification followed by
219 // a separator character, or with two separator characters. On POSIX 219 // a separator character, or with two separator characters. On POSIX
220 // platforms, an absolute path begins with a separator character. 220 // platforms, an absolute path begins with a separator character.
221 bool IsAbsolute() const; 221 bool IsAbsolute() const;
222 222
223 // Returns a copy of this FilePath that does not end with a trailing 223 // Returns a copy of this FilePath that does not end with a trailing
224 // separator. 224 // separator.
225 FilePath StripTrailingSeparators() const; 225 FilePath StripTrailingSeparators() const;
226 226
227 // Returns true if this FilePath contains any attempt to reference a parent
228 // directory (i.e. has a path component that is ".."
229 bool ReferencesParent() const;
230
227 // Older Chromium code assumes that paths are always wstrings. 231 // Older Chromium code assumes that paths are always wstrings.
228 // This function converts a wstring to a FilePath, and is useful to smooth 232 // This function converts a wstring to a FilePath, and is useful to smooth
229 // porting that old code to the FilePath API. 233 // porting that old code to the FilePath API.
230 // It has "Hack" in its name so people feel bad about using it. 234 // It has "Hack" in its name so people feel bad about using it.
231 // TODO(port): remove these functions. 235 // TODO(port): remove these functions.
232 static FilePath FromWStringHack(const std::wstring& wstring); 236 static FilePath FromWStringHack(const std::wstring& wstring);
233 237
234 // Older Chromium code assumes that paths are always wstrings. 238 // Older Chromium code assumes that paths are always wstrings.
235 // This function produces a wstring from a FilePath, and is useful to smooth 239 // This function produces a wstring from a FilePath, and is useful to smooth
236 // porting that old code to the FilePath API. 240 // porting that old code to the FilePath API.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 namespace stdext { 276 namespace stdext {
273 277
274 inline size_t hash_value(const FilePath& f) { 278 inline size_t hash_value(const FilePath& f) {
275 return hash_value(f.value()); 279 return hash_value(f.value());
276 } 280 }
277 281
278 } // namespace stdext 282 } // namespace stdext
279 #endif // COMPILER 283 #endif // COMPILER
280 284
281 #endif // BASE_FILE_PATH_H_ 285 #endif // BASE_FILE_PATH_H_
OLDNEW
« no previous file with comments | « no previous file | base/file_path.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698