| 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 18 matching lines...) Expand all Loading... |
| 29 //! \brief A file reader and writer backed by a virtual file, as opposed to a | 29 //! \brief A file reader and writer backed by a virtual file, as opposed to a |
| 30 //! file on disk or other operating system file descriptor-based file. | 30 //! file on disk or other operating system file descriptor-based file. |
| 31 //! | 31 //! |
| 32 //! The virtual file is a buffer in memory. This class is convenient for use | 32 //! The virtual file is a buffer in memory. This class is convenient for use |
| 33 //! with other code that normally expects to read or write files, when it is | 33 //! with other code that normally expects to read or write files, when it is |
| 34 //! impractical or inconvenient to read or write a file. It is expected that | 34 //! impractical or inconvenient to read or write a file. It is expected that |
| 35 //! tests, in particular, will benefit from using this class. | 35 //! tests, in particular, will benefit from using this class. |
| 36 class StringFile : public FileReaderInterface, public FileWriterInterface { | 36 class StringFile : public FileReaderInterface, public FileWriterInterface { |
| 37 public: | 37 public: |
| 38 StringFile(); | 38 StringFile(); |
| 39 ~StringFile(); | 39 ~StringFile() override; |
| 40 | 40 |
| 41 //! \brief Returns a string containing the virtual file’s contents. | 41 //! \brief Returns a string containing the virtual file’s contents. |
| 42 const std::string& string() const { return string_; } | 42 const std::string& string() const { return string_; } |
| 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`. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 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 |