crashpad::DelimitedFileReader Class Reference

Reads a file one field or line at a time. More...

`#include "util/file/delimited_file_reader.h"`

## Public Types

enum | Result
| The result of a GetDelim() or GetLine() call. More...

## Public Member Functions

| DelimitedFileReader (FileReaderInterface *file_reader)
Result | GetDelim (char delimiter, std::string *field)
| Reads a single field from the file. More...
Result | GetLine (std::string *line)
| Reads a single line from the file. More...

## Detailed Description

Reads a file one field or line at a time.

The file is interpreted as a series of fields separated by delimiter characters. When the delimiter character is the newline character (`'\n'`), the file is interpreted as a series of lines.

It is safe to mix GetDelim() and GetLine() calls, if appropriate for the format being interpreted.

This is a replacement for the standard library’s `getdelim()` and `getline()` functions, adapted to work with FileReaderInterface objects instead of `FILE*` streams.

## Member Enumeration Documentation

## Result

enum crashpad::DelimitedFileReader::Result

strong

The result of a GetDelim() or GetLine() call.

Enumerator
kError | An error occurred, and a message was logged.
kSuccess | A field or line was read from the file.
kEndOfFile | The end of the file was encountered.

## Member Function Documentation

## GetDelim()

DelimitedFileReader::Result crashpad::DelimitedFileReader::GetDelim | ( | char | delimiter,
|  | std::string * | field
| ) |  |

Reads a single field from the file.

Parameters

  [in] | delimiter | The delimiter character that terminates the field. It is safe to call this method multiple times while changing the value of this parameter, if appropriate for the format being interpreted.
  [out] | field | The field read from the file. This parameter will include the field’s terminating delimiter character unless the field was at the end of the file and was read without such a character. This parameter will not be empty.

Returns
  a Result value. field is only valid when Result::kSuccess is returned.

## GetLine()

DelimitedFileReader::Result crashpad::DelimitedFileReader::GetLine | ( | std::string * | line | ) |

Reads a single line from the file.

Parameters

  [out] | line | The line read from the file. This parameter will include the line terminating delimiter character unless the line was at the end of the file and was read without such a character. This parameter will not be empty.

Returns
  a Result value. line is only valid when Result::kSuccess is returned.

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

- util/file/delimited_file_reader.h
- util/file/delimited_file_reader.cc