| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 bool ReadUInt16(uint16* result) WARN_UNUSED_RESULT; | 35 bool ReadUInt16(uint16* result) WARN_UNUSED_RESULT; |
| 36 bool ReadUInt32(uint32* result) WARN_UNUSED_RESULT; | 36 bool ReadUInt32(uint32* result) WARN_UNUSED_RESULT; |
| 37 bool ReadInt64(int64* result) WARN_UNUSED_RESULT; | 37 bool ReadInt64(int64* result) WARN_UNUSED_RESULT; |
| 38 bool ReadUInt64(uint64* result) WARN_UNUSED_RESULT; | 38 bool ReadUInt64(uint64* result) WARN_UNUSED_RESULT; |
| 39 bool ReadSizeT(size_t* result) WARN_UNUSED_RESULT; | 39 bool ReadSizeT(size_t* result) WARN_UNUSED_RESULT; |
| 40 bool ReadFloat(float* result) WARN_UNUSED_RESULT; | 40 bool ReadFloat(float* result) WARN_UNUSED_RESULT; |
| 41 bool ReadDouble(double* result) WARN_UNUSED_RESULT; | 41 bool ReadDouble(double* result) WARN_UNUSED_RESULT; |
| 42 bool ReadString(std::string* result) WARN_UNUSED_RESULT; | 42 bool ReadString(std::string* result) WARN_UNUSED_RESULT; |
| 43 // The StringPiece data will only be valid for the lifetime of the message. | 43 // The StringPiece data will only be valid for the lifetime of the message. |
| 44 bool ReadStringPiece(base::StringPiece* result) WARN_UNUSED_RESULT; | 44 bool ReadStringPiece(base::StringPiece* result) WARN_UNUSED_RESULT; |
| 45 bool ReadWString(std::wstring* result) WARN_UNUSED_RESULT; | |
| 46 bool ReadString16(base::string16* result) WARN_UNUSED_RESULT; | 45 bool ReadString16(base::string16* result) WARN_UNUSED_RESULT; |
| 47 // The StringPiece16 data will only be valid for the lifetime of the message. | 46 // The StringPiece16 data will only be valid for the lifetime of the message. |
| 48 bool ReadStringPiece16(base::StringPiece16* result) WARN_UNUSED_RESULT; | 47 bool ReadStringPiece16(base::StringPiece16* result) WARN_UNUSED_RESULT; |
| 49 | 48 |
| 50 // A pointer to the data will be placed in |*data|, and the length will be | 49 // A pointer to the data will be placed in |*data|, and the length will be |
| 51 // placed in |*length|. The pointer placed into |*data| points into the | 50 // placed in |*length|. The pointer placed into |*data| points into the |
| 52 // message's buffer so it will be scoped to the lifetime of the message (or | 51 // message's buffer so it will be scoped to the lifetime of the message (or |
| 53 // until the message data is mutated). Do not keep the pointer around! | 52 // until the message data is mutated). Do not keep the pointer around! |
| 54 bool ReadData(const char** data, int* length) WARN_UNUSED_RESULT; | 53 bool ReadData(const char** data, int* length) WARN_UNUSED_RESULT; |
| 55 | 54 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 // 32-bit and 64-bit processes. | 193 // 32-bit and 64-bit processes. |
| 195 return WritePOD(static_cast<uint64>(value)); | 194 return WritePOD(static_cast<uint64>(value)); |
| 196 } | 195 } |
| 197 bool WriteFloat(float value) { | 196 bool WriteFloat(float value) { |
| 198 return WritePOD(value); | 197 return WritePOD(value); |
| 199 } | 198 } |
| 200 bool WriteDouble(double value) { | 199 bool WriteDouble(double value) { |
| 201 return WritePOD(value); | 200 return WritePOD(value); |
| 202 } | 201 } |
| 203 bool WriteString(const base::StringPiece& value); | 202 bool WriteString(const base::StringPiece& value); |
| 204 bool WriteWString(const std::wstring& value); | |
| 205 bool WriteString16(const base::StringPiece16& value); | 203 bool WriteString16(const base::StringPiece16& value); |
| 206 // "Data" is a blob with a length. When you read it out you will be given the | 204 // "Data" is a blob with a length. When you read it out you will be given the |
| 207 // length. See also WriteBytes. | 205 // length. See also WriteBytes. |
| 208 bool WriteData(const char* data, int length); | 206 bool WriteData(const char* data, int length); |
| 209 // "Bytes" is a blob with no length. The caller must specify the length both | 207 // "Bytes" is a blob with no length. The caller must specify the length both |
| 210 // when reading and writing. It is normally used to serialize PoD types of a | 208 // when reading and writing. It is normally used to serialize PoD types of a |
| 211 // known size. See also WriteData. | 209 // known size. See also WriteData. |
| 212 bool WriteBytes(const void* data, int length); | 210 bool WriteBytes(const void* data, int length); |
| 213 | 211 |
| 214 // Reserves space for upcoming writes when multiple writes will be made and | 212 // Reserves space for upcoming writes when multiple writes will be made and |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 } | 298 } |
| 301 inline void WriteBytesCommon(const void* data, size_t length); | 299 inline void WriteBytesCommon(const void* data, size_t length); |
| 302 | 300 |
| 303 FRIEND_TEST_ALL_PREFIXES(PickleTest, Resize); | 301 FRIEND_TEST_ALL_PREFIXES(PickleTest, Resize); |
| 304 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNext); | 302 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNext); |
| 305 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNextWithIncompleteHeader); | 303 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNextWithIncompleteHeader); |
| 306 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNextOverflow); | 304 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNextOverflow); |
| 307 }; | 305 }; |
| 308 | 306 |
| 309 #endif // BASE_PICKLE_H__ | 307 #endif // BASE_PICKLE_H__ |
| OLD | NEW |