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

Side by Side Diff: base/files/file_path.h

Issue 1446363003: Deleted OS_WIN and all Windows specific files from base. (Closed) Base URL: https://github.com/domokit/mojo.git@base_tests
Patch Set: Created 5 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
« no previous file with comments | « base/files/file_enumerator_win.cc ('k') | base/files/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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 #include "base/compiler_specific.h" 112 #include "base/compiler_specific.h"
113 #include "base/containers/hash_tables.h" 113 #include "base/containers/hash_tables.h"
114 #include "base/strings/string16.h" 114 #include "base/strings/string16.h"
115 #include "base/strings/string_piece.h" // For implicit conversions. 115 #include "base/strings/string_piece.h" // For implicit conversions.
116 #include "build/build_config.h" 116 #include "build/build_config.h"
117 117
118 // Windows-style drive letter support and pathname separator characters can be 118 // Windows-style drive letter support and pathname separator characters can be
119 // enabled and disabled independently, to aid testing. These #defines are 119 // enabled and disabled independently, to aid testing. These #defines are
120 // here so that the same setting can be used in both the implementation and 120 // here so that the same setting can be used in both the implementation and
121 // in the unit test. 121 // in the unit test.
122 #if defined(OS_WIN)
123 #define FILE_PATH_USES_DRIVE_LETTERS
124 #define FILE_PATH_USES_WIN_SEPARATORS
125 #endif // OS_WIN
126 122
127 namespace base { 123 namespace base {
128 124
129 class Pickle; 125 class Pickle;
130 class PickleIterator; 126 class PickleIterator;
131 127
132 // An abstraction to isolate users from the differences between native 128 // An abstraction to isolate users from the differences between native
133 // pathnames on different platforms. 129 // pathnames on different platforms.
134 class BASE_EXPORT FilePath { 130 class BASE_EXPORT FilePath {
135 public: 131 public:
136 #if defined(OS_POSIX) 132 #if defined(OS_POSIX)
137 // On most platforms, native pathnames are char arrays, and the encoding 133 // On most platforms, native pathnames are char arrays, and the encoding
138 // may or may not be specified. On Mac OS X, native pathnames are encoded 134 // may or may not be specified. On Mac OS X, native pathnames are encoded
139 // in UTF-8. 135 // in UTF-8.
140 typedef std::string StringType; 136 typedef std::string StringType;
141 #elif defined(OS_WIN) 137 #endif // OS_POSIX
142 // On Windows, for Unicode-aware applications, native pathnames are wchar_t
143 // arrays encoded in UTF-16.
144 typedef std::wstring StringType;
145 #endif // OS_WIN
146 138
147 typedef StringType::value_type CharType; 139 typedef StringType::value_type CharType;
148 140
149 // Null-terminated array of separators used to separate components in 141 // Null-terminated array of separators used to separate components in
150 // hierarchical paths. Each character in this array is a valid separator, 142 // hierarchical paths. Each character in this array is a valid separator,
151 // but kSeparators[0] is treated as the canonical separator and will be used 143 // but kSeparators[0] is treated as the canonical separator and will be used
152 // when composing pathnames. 144 // when composing pathnames.
153 static const CharType kSeparators[]; 145 static const CharType kSeparators[];
154 146
155 // arraysize(kSeparators). 147 // arraysize(kSeparators).
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 // This should not be used in production code - call ToString() instead. 433 // This should not be used in production code - call ToString() instead.
442 void PrintTo(const FilePath& path, std::ostream* out); 434 void PrintTo(const FilePath& path, std::ostream* out);
443 435
444 } // namespace base 436 } // namespace base
445 437
446 // Macros for string literal initialization of FilePath::CharType[], and for 438 // Macros for string literal initialization of FilePath::CharType[], and for
447 // using a FilePath::CharType[] in a printf-style format string. 439 // using a FilePath::CharType[] in a printf-style format string.
448 #if defined(OS_POSIX) 440 #if defined(OS_POSIX)
449 #define FILE_PATH_LITERAL(x) x 441 #define FILE_PATH_LITERAL(x) x
450 #define PRFilePath "s" 442 #define PRFilePath "s"
451 #elif defined(OS_WIN) 443 #endif // OS_POSIX
452 #define FILE_PATH_LITERAL(x) L ## x
453 #define PRFilePath "ls"
454 #endif // OS_WIN
455 444
456 // Provide a hash function so that hash_sets and maps can contain FilePath 445 // Provide a hash function so that hash_sets and maps can contain FilePath
457 // objects. 446 // objects.
458 namespace BASE_HASH_NAMESPACE { 447 namespace BASE_HASH_NAMESPACE {
459 448
460 template<> 449 template<>
461 struct hash<base::FilePath> { 450 struct hash<base::FilePath> {
462 size_t operator()(const base::FilePath& f) const { 451 size_t operator()(const base::FilePath& f) const {
463 return hash<base::FilePath::StringType>()(f.value()); 452 return hash<base::FilePath::StringType>()(f.value());
464 } 453 }
465 }; 454 };
466 455
467 } // namespace BASE_HASH_NAMESPACE 456 } // namespace BASE_HASH_NAMESPACE
468 457
469 #endif // BASE_FILES_FILE_PATH_H_ 458 #endif // BASE_FILES_FILE_PATH_H_
OLDNEW
« no previous file with comments | « base/files/file_enumerator_win.cc ('k') | base/files/file_path.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698