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

Side by Side Diff: base/file_path.h

Issue 165330: Disable RTTI and C++ exceptions (Closed) Base URL: svn://svn.chromium.org/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/hash_tables.h » ('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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // | 59 // |
60 // | void Function() { 60 // | void Function() {
61 // | FilePath log_file_path(kLogFileName); 61 // | FilePath log_file_path(kLogFileName);
62 // | [...] 62 // | [...]
63 // | } 63 // | }
64 64
65 #ifndef BASE_FILE_PATH_H_ 65 #ifndef BASE_FILE_PATH_H_
66 #define BASE_FILE_PATH_H_ 66 #define BASE_FILE_PATH_H_
67 67
68 #include <string> 68 #include <string>
69 #include <vector>
69 70
70 #include "base/basictypes.h" 71 #include "base/basictypes.h"
71 #include "base/compiler_specific.h" 72 #include "base/compiler_specific.h"
72 #include "base/hash_tables.h" 73 #include "base/hash_tables.h"
73 #include "base/string_piece.h" // For implicit conversions. 74 #include "base/string_piece.h" // For implicit conversions.
74 75
75 // Windows-style drive letter support and pathname separator characters can be 76 // Windows-style drive letter support and pathname separator characters can be
76 // enabled and disabled independently, to aid testing. These #defines are 77 // enabled and disabled independently, to aid testing. These #defines are
77 // here so that the same setting can be used in both the implementation and 78 // here so that the same setting can be used in both the implementation and
78 // in the unit test. 79 // in the unit test.
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 StringType path_; 250 StringType path_;
250 }; 251 };
251 252
252 // Macros for string literal initialization of FilePath::CharType[]. 253 // Macros for string literal initialization of FilePath::CharType[].
253 #if defined(OS_POSIX) 254 #if defined(OS_POSIX)
254 #define FILE_PATH_LITERAL(x) x 255 #define FILE_PATH_LITERAL(x) x
255 #elif defined(OS_WIN) 256 #elif defined(OS_WIN)
256 #define FILE_PATH_LITERAL(x) L ## x 257 #define FILE_PATH_LITERAL(x) L ## x
257 #endif // OS_WIN 258 #endif // OS_WIN
258 259
259 // Implement hash function so that we can use FilePaths in hashsets and maps. 260 // Provide a hash function so that hash_sets and maps can contain FilePath
261 // objects.
260 #if defined(COMPILER_GCC) 262 #if defined(COMPILER_GCC)
261 namespace __gnu_cxx { 263 namespace __gnu_cxx {
262 264
263 template<> 265 template<>
264 struct hash<FilePath> { 266 struct hash<FilePath> {
265 size_t operator()(const FilePath& f) const { 267 std::size_t operator()(const FilePath& f) const {
266 return std::tr1::hash<FilePath::StringType>()(f.value()); 268 return hash<FilePath::StringType>()(f.value());
267 } 269 }
268 }; 270 };
269 271
270 } // namespace __gnu_cxx 272 } // namespace __gnu_cxx
271 #elif defined(COMPILER_MSVC) 273 #elif defined(COMPILER_MSVC)
272 namespace stdext { 274 namespace stdext {
273 275
274 inline size_t hash_value(const FilePath& f) { 276 inline size_t hash_value(const FilePath& f) {
275 return hash_value(f.value()); 277 return hash_value(f.value());
276 } 278 }
277 279
278 } // namespace stdext 280 } // namespace stdext
279 #endif // COMPILER 281 #endif // COMPILER
280 282
281 #endif // BASE_FILE_PATH_H_ 283 #endif // BASE_FILE_PATH_H_
OLDNEW
« no previous file with comments | « no previous file | base/hash_tables.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698