Crashpad
Public Member Functions | List of all members
crashpad::FileReaderInterface Class Referenceabstract

An interface to read to files and other file-like objects with semantics matching the underlying platform (POSIX or Windows). More...

#include "util/file/file_reader.h"

Inheritance diagram for crashpad::FileReaderInterface:
crashpad::FileSeekerInterface crashpad::FileReader crashpad::StringFile crashpad::WeakFileHandleFileReader

Public Member Functions

virtual FileOperationResult Read (void *data, size_t size)=0
 Wraps ReadFile(), or provides an implementation with identical semantics. More...
 
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
virtual FileOffset Seek (FileOffset offset, int whence)=0
 Wraps LoggingSeekFile() or provides an alternate implementation with identical semantics. More...
 
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...
 

Detailed Description

An interface to read to files and other file-like objects with semantics matching the underlying platform (POSIX or Windows).

Member Function Documentation

◆ Read()

virtual FileOperationResult crashpad::FileReaderInterface::Read ( void *  data,
size_t  size 
)
pure virtual

Wraps ReadFile(), or provides an implementation with identical semantics.

Returns
The number of bytes actually read if the operation succeeded, which may be 0 or any positive value less than or equal to size. -1 if the operation failed, with an error message logged.

Implemented in crashpad::FileReader, crashpad::WeakFileHandleFileReader, and crashpad::StringFile.

◆ ReadExactly()

bool crashpad::FileReaderInterface::ReadExactly ( void *  data,
size_t  size 
)

Wraps Read(), ensuring that the read succeeded and exactly size bytes were read.

Semantically, this behaves as LoggingReadFileExactly().

Returns
true if the operation succeeded, false if it failed, with an error message logged. Short reads are treated as failures.

The documentation for this class was generated from the following files: