OpenTTD Source 20250505-master-ga46b885640
BaseStringBuilder Class Referenceabstract

Compose data into a string / buffer. More...

#include <string_builder.hpp>

Inheritance diagram for BaseStringBuilder:
InPlaceBuilder StringBuilder

Public Types

using size_type = std::string_view::size_type
 

Public Member Functions

virtual void PutBuffer (std::span< const char > str)=0
 Append buffer.
 
void Put (std::string_view str)
 Append string.
 
void PutUint8 (uint8_t value)
 Append binary uint8.
 
void PutSint8 (int8_t value)
 Append binary int8.
 
void PutUint16LE (uint16_t value)
 Append binary uint16 using little endian.
 
void PutSint16LE (int16_t value)
 Append binary int16 using little endian.
 
void PutUint32LE (uint32_t value)
 Append binary uint32 using little endian.
 
void PutSint32LE (int32_t value)
 Append binary int32 using little endian.
 
void PutUint64LE (uint64_t value)
 Append binary uint64 using little endian.
 
void PutSint64LE (int64_t value)
 Append binary int64 using little endian.
 
void PutChar (char c)
 Append 8-bit char.
 
void PutUtf8 (char32_t c)
 Append UTF.8 char.
 
template<class T >
void PutIntegerBase (T value, int base)
 Append integer 'value' in given number 'base'.
 

Detailed Description

Compose data into a string / buffer.

Definition at line 20 of file string_builder.hpp.

Member Typedef Documentation

◆ size_type

using BaseStringBuilder::size_type = std::string_view::size_type

Definition at line 22 of file string_builder.hpp.

Member Function Documentation

◆ Put()

void BaseStringBuilder::Put ( std::string_view  str)
inline

◆ PutBuffer()

virtual void BaseStringBuilder::PutBuffer ( std::span< const char >  str)
pure virtual

Append buffer.

Implemented in StringBuilder, and InPlaceBuilder.

Referenced by Put(), PutIntegerBase(), PutUint16LE(), PutUint32LE(), PutUint64LE(), PutUint8(), and PutUtf8().

◆ PutChar()

void BaseStringBuilder::PutChar ( char  c)

Append 8-bit char.

Definition at line 105 of file string_builder.cpp.

References PutUint8().

Referenced by FormatNumber(), MakeCzechTownName(), StrMakeValidInPlace(), and TranslateTTDPatchCodes().

◆ PutIntegerBase()

template<class T >
void BaseStringBuilder::PutIntegerBase ( value,
int  base 
)
inline

Append integer 'value' in given number 'base'.

Definition at line 52 of file string_builder.hpp.

References PutBuffer().

Referenced by FixSCCEncodedNegative(), and GetEncodedStringWithArgs().

◆ PutSint16LE()

void BaseStringBuilder::PutSint16LE ( int16_t  value)

Append binary int16 using little endian.

Definition at line 49 of file string_builder.cpp.

References PutUint16LE().

◆ PutSint32LE()

void BaseStringBuilder::PutSint32LE ( int32_t  value)

Append binary int32 using little endian.

Definition at line 71 of file string_builder.cpp.

References PutUint32LE().

◆ PutSint64LE()

void BaseStringBuilder::PutSint64LE ( int64_t  value)

Append binary int64 using little endian.

Definition at line 97 of file string_builder.cpp.

References PutUint64LE().

◆ PutSint8()

void BaseStringBuilder::PutSint8 ( int8_t  value)

Append binary int8.

Definition at line 29 of file string_builder.cpp.

References PutUint8().

◆ PutUint16LE()

void BaseStringBuilder::PutUint16LE ( uint16_t  value)

Append binary uint16 using little endian.

Definition at line 37 of file string_builder.cpp.

References PutBuffer().

Referenced by UnmappedChoiceList::Flush(), PutSint16LE(), and LanguageWriter::WriteLang().

◆ PutUint32LE()

void BaseStringBuilder::PutUint32LE ( uint32_t  value)

Append binary uint32 using little endian.

Definition at line 57 of file string_builder.cpp.

References PutBuffer().

Referenced by PutSint32LE().

◆ PutUint64LE()

void BaseStringBuilder::PutUint64LE ( uint64_t  value)

Append binary uint64 using little endian.

Definition at line 79 of file string_builder.cpp.

References PutBuffer().

Referenced by PutSint64LE().

◆ PutUint8()

void BaseStringBuilder::PutUint8 ( uint8_t  value)

Append binary uint8.

Definition at line 18 of file string_builder.cpp.

References PutBuffer().

Referenced by UnmappedChoiceList::Flush(), FormatString(), PutChar(), PutSint8(), and LanguageWriter::WriteLang().

◆ PutUtf8()


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