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

Side by Side Diff: base/file_path.h

Issue 14827: Implement FilePath::Contains() (Closed)
Patch Set: Make it work on mac and linux Created 12 years 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
« 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // it is an error to pass an absolute path. 152 // it is an error to pass an absolute path.
153 FilePath Append(const StringType& component) const WARN_UNUSED_RESULT; 153 FilePath Append(const StringType& component) const WARN_UNUSED_RESULT;
154 FilePath Append(const FilePath& component) const WARN_UNUSED_RESULT; 154 FilePath Append(const FilePath& component) const WARN_UNUSED_RESULT;
155 155
156 // Returns true if this FilePath contains an absolute path. On Windows, an 156 // Returns true if this FilePath contains an absolute path. On Windows, an
157 // absolute path begins with either a drive letter specification followed by 157 // absolute path begins with either a drive letter specification followed by
158 // a separator character, or with two separator characters. On POSIX 158 // a separator character, or with two separator characters. On POSIX
159 // platforms, an absolute path begins with a separator character. 159 // platforms, an absolute path begins with a separator character.
160 bool IsAbsolute() const; 160 bool IsAbsolute() const;
161 161
162 // Returns true if this FilePath represents a parent dir of |other|. Both
163 // paths are normalized before doing the comparison, but neither |this| nor
164 // |other| are modified.
165 bool Contains(const FilePath& other) const;
166
162 // Returns a copy of this FilePath that does not end with a trailing 167 // Returns a copy of this FilePath that does not end with a trailing
163 // separator. 168 // separator.
164 FilePath StripTrailingSeparators() const; 169 FilePath StripTrailingSeparators() const;
165 170
166 // Older Chromium code assumes that paths are always wstrings. 171 // Older Chromium code assumes that paths are always wstrings.
167 // This function converts a wstring to a FilePath, and is useful to smooth 172 // This function converts a wstring to a FilePath, and is useful to smooth
168 // porting that old code to the FilePath API. 173 // porting that old code to the FilePath API.
169 // It has "Hack" in its name so people feel bad about using it. 174 // It has "Hack" in its name so people feel bad about using it.
170 // TODO(port): remove these functions. 175 // TODO(port): remove these functions.
171 static FilePath FromWStringHack(const std::wstring& wstring); 176 static FilePath FromWStringHack(const std::wstring& wstring);
(...skipping 17 matching lines...) Expand all
189 }; 194 };
190 195
191 // Macros for string literal initialization of FilePath::CharType[]. 196 // Macros for string literal initialization of FilePath::CharType[].
192 #if defined(OS_POSIX) 197 #if defined(OS_POSIX)
193 #define FILE_PATH_LITERAL(x) x 198 #define FILE_PATH_LITERAL(x) x
194 #elif defined(OS_WIN) 199 #elif defined(OS_WIN)
195 #define FILE_PATH_LITERAL(x) L ## x 200 #define FILE_PATH_LITERAL(x) L ## x
196 #endif // OS_WIN 201 #endif // OS_WIN
197 202
198 #endif // BASE_FILE_PATH_H_ 203 #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