OLD | NEW |
---|---|
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 | 43 |
44 //! \brief Sets the virtual file’s contents to \a string, and resets its file | 44 //! \brief Sets the virtual file’s contents to \a string, and resets its file |
45 //! position to `0`. | 45 //! position to `0`. |
46 void SetString(const std::string& string); | 46 void SetString(const std::string& string); |
47 | 47 |
48 //! \brief Resets the virtual file’s contents to be empty, and resets its file | 48 //! \brief Resets the virtual file’s contents to be empty, and resets its file |
49 //! position to `0`. | 49 //! position to `0`. |
50 void Reset(); | 50 void Reset(); |
51 | 51 |
52 // FileReaderInterface: | 52 // FileReaderInterface: |
53 ssize_t Read(void* data, size_t size) override; | 53 FileOperationResult Read(void* data, size_t size) override; |
Mark Mentovai
2015/10/22 22:56:18
#include file_io.h.
scottmg
2015/10/22 23:13:40
Done.
| |
54 | 54 |
55 // FileWriterInterface: | 55 // FileWriterInterface: |
56 bool Write(const void* data, size_t size) override; | 56 bool Write(const void* data, size_t size) override; |
57 bool WriteIoVec(std::vector<WritableIoVec>* iovecs) override; | 57 bool WriteIoVec(std::vector<WritableIoVec>* iovecs) override; |
58 | 58 |
59 // FileSeekerInterface: | 59 // FileSeekerInterface: |
60 FileOffset Seek(FileOffset offset, int whence) override; | 60 FileOffset Seek(FileOffset offset, int whence) override; |
61 | 61 |
62 private: | 62 private: |
63 //! \brief The virtual file’s contents. | 63 //! \brief The virtual file’s contents. |
64 std::string string_; | 64 std::string string_; |
65 | 65 |
66 //! \brief The file offset of the virtual file. | 66 //! \brief The file offset of the virtual file. |
67 //! | 67 //! |
68 //! \note This is stored in a `size_t` to match the characteristics of | 68 //! \note This is stored in a `size_t` to match the characteristics of |
69 //! #string_, the `std::string` used to store the virtual file’s contents. | 69 //! #string_, the `std::string` used to store the virtual file’s contents. |
70 //! This type will have different characteristics than the `off_t` used to | 70 //! This type will have different characteristics than the `off_t` used to |
71 //! report file offsets. The implementation must take care when converting | 71 //! report file offsets. The implementation must take care when converting |
72 //! between these distinct types. | 72 //! between these distinct types. |
73 base::CheckedNumeric<size_t> offset_; | 73 base::CheckedNumeric<size_t> offset_; |
74 | 74 |
75 DISALLOW_COPY_AND_ASSIGN(StringFile); | 75 DISALLOW_COPY_AND_ASSIGN(StringFile); |
76 }; | 76 }; |
77 | 77 |
78 } // namespace crashpad | 78 } // namespace crashpad |
79 | 79 |
80 #endif // CRASHPAD_UTIL_FILE_STRING_FILE_H_ | 80 #endif // CRASHPAD_UTIL_FILE_STRING_FILE_H_ |
OLD | NEW |