OLD | NEW |
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 // Copied from strings/stringpiece.h with modifications | 4 // Copied from strings/stringpiece.h with modifications |
5 // | 5 // |
6 // A string-like object that points to a sized piece of memory. | 6 // A string-like object that points to a sized piece of memory. |
7 // | 7 // |
8 // You can use StringPiece as a function or method parameter. A StringPiece | 8 // You can use StringPiece as a function or method parameter. A StringPiece |
9 // parameter can receive a double-quoted string literal argument, a "const | 9 // parameter can receive a double-quoted string literal argument, a "const |
10 // char*" argument, a string argument, or a StringPiece argument with no data | 10 // char*" argument, a string argument, or a StringPiece argument with no data |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 #ifndef BASE_STRINGS_STRING_PIECE_H_ | 22 #ifndef BASE_STRINGS_STRING_PIECE_H_ |
23 #define BASE_STRINGS_STRING_PIECE_H_ | 23 #define BASE_STRINGS_STRING_PIECE_H_ |
24 | 24 |
25 #include <stddef.h> | 25 #include <stddef.h> |
26 | 26 |
27 #include <iosfwd> | 27 #include <iosfwd> |
28 #include <string> | 28 #include <string> |
29 | 29 |
30 #include "base/base_export.h" | 30 #include "base/base_export.h" |
31 #include "base/basictypes.h" | |
32 #include "base/containers/hash_tables.h" | 31 #include "base/containers/hash_tables.h" |
33 #include "base/logging.h" | 32 #include "base/logging.h" |
34 #include "base/strings/string16.h" | 33 #include "base/strings/string16.h" |
35 | 34 |
36 namespace base { | 35 namespace base { |
37 | 36 |
38 template <typename STRING_TYPE> class BasicStringPiece; | 37 template <typename STRING_TYPE> class BasicStringPiece; |
39 typedef BasicStringPiece<std::string> StringPiece; | 38 typedef BasicStringPiece<std::string> StringPiece; |
40 typedef BasicStringPiece<string16> StringPiece16; | 39 typedef BasicStringPiece<string16> StringPiece16; |
41 | 40 |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 template<> | 460 template<> |
462 struct hash<base::StringPiece16> { | 461 struct hash<base::StringPiece16> { |
463 std::size_t operator()(const base::StringPiece16& sp16) const { | 462 std::size_t operator()(const base::StringPiece16& sp16) const { |
464 HASH_STRING_PIECE(base::StringPiece16, sp16); | 463 HASH_STRING_PIECE(base::StringPiece16, sp16); |
465 } | 464 } |
466 }; | 465 }; |
467 | 466 |
468 } // namespace BASE_HASH_NAMESPACE | 467 } // namespace BASE_HASH_NAMESPACE |
469 | 468 |
470 #endif // BASE_STRINGS_STRING_PIECE_H_ | 469 #endif // BASE_STRINGS_STRING_PIECE_H_ |
OLD | NEW |