OpenTTD Source 20260218-master-g2123fca5ea
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)
 Copy constructor.
InPlaceReplacementoperator= (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 114 of file string_inplace.hpp.

Constructor & Destructor Documentation

◆ InPlaceReplacement() [1/2]

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

Create coupled Consumer+Builder pair.

Parameters
bufferData to consume and replace.
Note
The lifetime of the buffer must exceed the lifetime of both the Consumer and the Builder.

Definition at line 49 of file string_inplace.cpp.

References builder, and consumer.

Referenced by InPlaceReplacement().

◆ InPlaceReplacement() [2/2]

InPlaceReplacement::InPlaceReplacement ( const InPlaceReplacement & src)

Copy constructor.

Parameters
srcThe in place replacement to copy.
Note
The lifetime of the buffer must exceed the lifetime of both the Consumer and the Builder.

Definition at line 59 of file string_inplace.cpp.

References builder, consumer, and InPlaceReplacement().

Member Function Documentation

◆ operator=()

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

Definition at line 64 of file string_inplace.cpp.

Field Documentation

◆ builder

InPlaceBuilder InPlaceReplacement::builder

Builder into shared buffer.

Definition at line 117 of file string_inplace.hpp.

Referenced by InPlaceReplacement(), InPlaceReplacement(), StrMakeValidInPlace(), and StrMakeValidInPlace().

◆ consumer

StringConsumer InPlaceReplacement::consumer

Consumer from shared buffer.

Definition at line 116 of file string_inplace.hpp.

Referenced by InPlaceReplacement(), InPlaceReplacement(), StrMakeValidInPlace(), and StrMakeValidInPlace().


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