OpenTTD Source: OutputBuffer Class Reference

OpenTTD Source 15.0-RC2

Public Member Functions | Data Fields
OutputBuffer Class Reference

Output buffer for a block of data. More...

## Public Member Functions
void | Clear ()
| Prepare buffer for use.
size_t | Add (std::string_view text)
| Add text to the output buffer.
void | Write (FILE *out_fp) const
| Dump buffer to the output stream.
bool | HasRoom () const
| Does the block have room for more data?

## Data Fields
size_t | size
| Number of bytes stored in data.
char | data [OUTPUT_BLOCK_SIZE]
| Stored data.

## Detailed Description

Output buffer for a block of data.

Definition at line 37 of file settingsgen.cpp.

## Member Function Documentation

## ◆ Add()

size_t OutputBuffer::Add | ( | std::string_view | text | ) |
| inline

Add text to the output buffer.

Parameters

  text | Text to store.
  length | Length of the text in bytes.

Returns
  Number of bytes actually stored.

Definition at line 51 of file settingsgen.cpp.

References data, OUTPUT_BLOCK_SIZE, and size.

Referenced by OutputStore::Add().

## ◆ Clear()

void OutputBuffer::Clear | ( |  | ) |
| inline

Prepare buffer for use.

Definition at line 40 of file settingsgen.cpp.

References size.

Referenced by OutputStore::Add().

## ◆ HasRoom()

bool OutputBuffer::HasRoom | ( |  | ) | const
| inline

Does the block have room for more data?

Returns
  `true` if room is available, else `false`.

Definition at line 73 of file settingsgen.cpp.

References OUTPUT_BLOCK_SIZE, and size.

## ◆ Write()

void OutputBuffer::Write | ( | FILE * | out_fp | ) | const
| inline

Dump buffer to the output stream.

Parameters

  out_fp | Stream to write the data to.

Definition at line 62 of file settingsgen.cpp.

References data, and size.

## Field Documentation

## ◆ data

char OutputBuffer::data[OUTPUT_BLOCK_SIZE]

Stored data.

Definition at line 79 of file settingsgen.cpp.

Referenced by Add(), and Write().

## ◆ size

size_t OutputBuffer::size

Number of bytes stored in data.

Definition at line 78 of file settingsgen.cpp.

Referenced by Add(), Clear(), HasRoom(), and Write().

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

- src/settingsgen/settingsgen.cpp