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

Side by Side Diff: base/file_path.h

Issue 337042: Revert 30168 - Commit patch set from http://codereview.chromium.org/149796... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 // directory (i.e. has a path component that is ".." 287 // directory (i.e. has a path component that is ".."
288 bool ReferencesParent() const; 288 bool ReferencesParent() const;
289 289
290 // Older Chromium code assumes that paths are always wstrings. 290 // Older Chromium code assumes that paths are always wstrings.
291 // This function converts a wstring to a FilePath, and is useful to smooth 291 // This function converts a wstring to a FilePath, and is useful to smooth
292 // porting that old code to the FilePath API. 292 // porting that old code to the FilePath API.
293 // It has "Hack" in its name so people feel bad about using it. 293 // It has "Hack" in its name so people feel bad about using it.
294 // TODO(port): remove these functions. 294 // TODO(port): remove these functions.
295 static FilePath FromWStringHack(const std::wstring& wstring); 295 static FilePath FromWStringHack(const std::wstring& wstring);
296 296
297 // Compare two strings in the same way the file system does.
298 // Note that these always ignore case, even on file systems that are case-
299 // sensitive. If case-sensitive comparison is ever needed, add corresponding
300 // methods here.
301 // The methods are written as a static method so that they can also be used
302 // on parts of a file path, e.g., just the extension.
303 // CompareIgnoreCase() returns -1, 0 or 1 for less-than, equal-to and
304 // greater-than respectively.
305 static int CompareIgnoreCase(const StringType& string1,
306 const StringType& string2);
307 static bool CompareEqualIgnoreCase(const StringType& string1,
308 const StringType& string2) {
309 return CompareIgnoreCase(string1, string2) == 0;
310 }
311 static bool CompareLessIgnoreCase(const StringType& string1,
312 const StringType& string2) {
313 return CompareIgnoreCase(string1, string2) < 0;
314 }
315
316 #if defined(OS_MACOSX)
317 // Returns the string in the special canonical decomposed form as defined for
318 // HFS, which is close to, but not quite, decomposition form D. See
319 // http://developer.apple.com/mac/library/technotes/tn/tn1150.html#UnicodeSubt leties
320 // for further comments.
321 // Returns the epmty string if the conversion failed.
322 static StringType GetHFSDecomposedForm(const FilePath::StringType& string);
323
324 // Special UTF-8 version of FastUnicodeCompare. Cf:
325 // http://developer.apple.com/mac/library/technotes/tn/tn1150.html#StringCompa risonAlgorithm
326 // IMPORTANT: The input strings must be in the special HFS decomposed form!
327 // (cf. above GetHFSDecomposedForm method)
328 static int HFSFastUnicodeCompare(const StringType& string1,
329 const StringType& string2);
330 #endif
331
332 // Older Chromium code assumes that paths are always wstrings. 297 // Older Chromium code assumes that paths are always wstrings.
333 // This function produces a wstring from a FilePath, and is useful to smooth 298 // This function produces a wstring from a FilePath, and is useful to smooth
334 // porting that old code to the FilePath API. 299 // porting that old code to the FilePath API.
335 // It has "Hack" in its name so people feel bad about using it. 300 // It has "Hack" in its name so people feel bad about using it.
336 // TODO(port): remove these functions. 301 // TODO(port): remove these functions.
337 std::wstring ToWStringHack() const; 302 std::wstring ToWStringHack() const;
338 303
339 private: 304 private:
340 // Remove trailing separators from this object. If the path is absolute, it 305 // Remove trailing separators from this object. If the path is absolute, it
341 // will never be stripped any more than to refer to the absolute root 306 // will never be stripped any more than to refer to the absolute root
(...skipping 29 matching lines...) Expand all
371 namespace stdext { 336 namespace stdext {
372 337
373 inline size_t hash_value(const FilePath& f) { 338 inline size_t hash_value(const FilePath& f) {
374 return hash_value(f.value()); 339 return hash_value(f.value());
375 } 340 }
376 341
377 } // namespace stdext 342 } // namespace stdext
378 #endif // COMPILER 343 #endif // COMPILER
379 344
380 #endif // BASE_FILE_PATH_H_ 345 #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