Crashpad
|
A file reader and writer backed by a virtual file, as opposed to a file on disk or other operating system file descriptor-based file. More...
#include "util/file/string_file.h"
Public Member Functions | |
const std::string & | string () const |
Returns a string containing the virtual file’s contents. | |
void | SetString (const std::string &string) |
Sets the virtual file’s contents to string, and resets its file position to 0 . | |
void | Reset () |
Resets the virtual file’s contents to be empty, and resets its file position to 0 . | |
FileOperationResult | Read (void *data, size_t size) override |
Wraps ReadFile(), or provides an implementation with identical semantics. More... | |
bool | Write (const void *data, size_t size) override |
Wraps LoggingWriteFile(), or provides an implementation with identical semantics. More... | |
bool | WriteIoVec (std::vector< WritableIoVec > *iovecs) override |
Wraps writev() on POSIX or provides an alternate implementation with identical semantics. This method will write entire buffers, continuing after a short write or after being interrupted. On non-POSIX this is a simple wrapper around Write(). More... | |
FileOffset | Seek (FileOffset offset, int whence) override |
Wraps LoggingSeekFile() or provides an alternate implementation with identical semantics. More... | |
Public Member Functions inherited from crashpad::FileReaderInterface | |
bool | ReadExactly (void *data, size_t size) |
Wraps Read(), ensuring that the read succeeded and exactly size bytes were read. More... | |
Public Member Functions inherited from crashpad::FileSeekerInterface | |
FileOffset | SeekGet () |
Wraps Seek(), using SEEK_CUR to obtain the file’s current position. More... | |
bool | SeekSet (FileOffset offset) |
Wraps Seek(), using SEEK_SET , ensuring that the seek succeeded and the file is positioned as desired. More... | |
A file reader and writer backed by a virtual file, as opposed to a file on disk or other operating system file descriptor-based file.
The virtual file is a buffer in memory. This class is convenient for use with other code that normally expects to read or write files, when it is impractical or inconvenient to read or write a file. It is expected that tests, in particular, will benefit from using this class.
|
overridevirtual |
Wraps ReadFile(), or provides an implementation with identical semantics.
0
or any positive value less than or equal to size. -1
if the operation failed, with an error message logged. Implements crashpad::FileReaderInterface.
|
overridevirtual |
Wraps LoggingSeekFile() or provides an alternate implementation with identical semantics.
-1
on failure, with an error message logged. Implements crashpad::FileSeekerInterface.
|
overridevirtual |
Wraps LoggingWriteFile(), or provides an implementation with identical semantics.
true
if the operation succeeded, false
if it failed, with an error message logged. Implements crashpad::FileWriterInterface.
|
overridevirtual |
Wraps writev()
on POSIX or provides an alternate implementation with identical semantics. This method will write entire buffers, continuing after a short write or after being interrupted. On non-POSIX this is a simple wrapper around Write().
true
if the operation succeeded, false
if it failed, with an error message logged.Implements crashpad::FileWriterInterface.