| 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 | 4 |
| 5 #ifndef BASE_PICKLE_H_ | 5 #ifndef BASE_PICKLE_H_ |
| 6 #define BASE_PICKLE_H_ | 6 #define BASE_PICKLE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 void AddUInt16() { return AddPOD<uint16_t>(); } | 125 void AddUInt16() { return AddPOD<uint16_t>(); } |
| 126 void AddUInt32() { return AddPOD<uint32_t>(); } | 126 void AddUInt32() { return AddPOD<uint32_t>(); } |
| 127 void AddInt64() { return AddPOD<int64_t>(); } | 127 void AddInt64() { return AddPOD<int64_t>(); } |
| 128 void AddUInt64() { return AddPOD<uint64_t>(); } | 128 void AddUInt64() { return AddPOD<uint64_t>(); } |
| 129 void AddFloat() { return AddPOD<float>(); } | 129 void AddFloat() { return AddPOD<float>(); } |
| 130 void AddDouble() { return AddPOD<double>(); } | 130 void AddDouble() { return AddPOD<double>(); } |
| 131 void AddString(const StringPiece& value); | 131 void AddString(const StringPiece& value); |
| 132 void AddString16(const StringPiece16& value); | 132 void AddString16(const StringPiece16& value); |
| 133 void AddData(int length); | 133 void AddData(int length); |
| 134 void AddBytes(int length); | 134 void AddBytes(int length); |
| 135 void AddAttachment(); |
| 135 | 136 |
| 136 private: | 137 private: |
| 137 // Just like AddBytes() but with a compile-time size for performance. | 138 // Just like AddBytes() but with a compile-time size for performance. |
| 138 template<size_t length> void BASE_EXPORT AddBytesStatic(); | 139 template<size_t length> void BASE_EXPORT AddBytesStatic(); |
| 139 | 140 |
| 140 template <typename T> | 141 template <typename T> |
| 141 void AddPOD() { AddBytesStatic<sizeof(T)>(); } | 142 void AddPOD() { AddBytesStatic<sizeof(T)>(); } |
| 142 | 143 |
| 143 size_t payload_size_ = 0; | 144 size_t payload_size_ = 0; |
| 144 }; | 145 }; |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 FRIEND_TEST_ALL_PREFIXES(PickleTest, PeekNext); | 376 FRIEND_TEST_ALL_PREFIXES(PickleTest, PeekNext); |
| 376 FRIEND_TEST_ALL_PREFIXES(PickleTest, PeekNextOverflow); | 377 FRIEND_TEST_ALL_PREFIXES(PickleTest, PeekNextOverflow); |
| 377 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNext); | 378 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNext); |
| 378 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNextWithIncompleteHeader); | 379 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNextWithIncompleteHeader); |
| 379 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNextOverflow); | 380 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNextOverflow); |
| 380 }; | 381 }; |
| 381 | 382 |
| 382 } // namespace base | 383 } // namespace base |
| 383 | 384 |
| 384 #endif // BASE_PICKLE_H_ | 385 #endif // BASE_PICKLE_H_ |
| OLD | NEW |