OpenTTD Source: InPlaceReplacement Class Reference

OpenTTD Source 15.3

Public Member Functions | Data Fields
InPlaceReplacement Class Reference

Compose data into a fixed size buffer, which is consumed at the same time. More...

`#include <string_inplace.hpp>`

## Public Member Functions
| InPlaceReplacement (std::span< char > buffer)
| Create coupled Consumer+Builder pair.
| InPlaceReplacement (const InPlaceReplacement &src)
InPlaceReplacement & | operator= (const InPlaceReplacement &src)

## Data Fields
StringConsumer | consumer
| Consumer from shared buffer.
InPlaceBuilder | builder
| Builder into shared buffer.

## Detailed Description

Compose data into a fixed size buffer, which is consumed at the same time.

- The Consumer reads data from a buffer.
- The Builder writes data to the buffer, replacing already consumed data.
- The Builder asserts, if it overtakes the consumer.

Definition at line 91 of file string_inplace.hpp.

## Constructor & Destructor Documentation

## ◆ InPlaceReplacement() [1/2]

InPlaceReplacement::InPlaceReplacement | ( | std::span< char > | buffer | ) |

Create coupled Consumer+Builder pair.

Parameters

  buffer | Data to consume and replace.

Note
  The lifetime of the buffer must exceed the lifetime of both the Consumer and the Builder.

Definition at line 48 of file string_inplace.cpp.

## ◆ InPlaceReplacement() [2/2]

InPlaceReplacement::InPlaceReplacement | ( | const InPlaceReplacement & | src | ) |

Definition at line 53 of file string_inplace.cpp.

## Member Function Documentation

## ◆ operator=()

InPlaceReplacement & InPlaceReplacement::operator= | ( | const InPlaceReplacement & | src | ) |

Definition at line 58 of file string_inplace.cpp.

## Field Documentation

## ◆ builder

InPlaceBuilder InPlaceReplacement::builder

Builder into shared buffer.

Definition at line 94 of file string_inplace.hpp.

Referenced by StrMakeValidInPlace(), and StrMakeValidInPlace().

## ◆ consumer

StringConsumer InPlaceReplacement::consumer

Consumer from shared buffer.

Definition at line 93 of file string_inplace.hpp.

Referenced by StrMakeValidInPlace(), and StrMakeValidInPlace().

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

- src/core/string_inplace.hpp
- src/core/string_inplace.cpp