OpenTTD Source 20250220-master-gf89924a727
EncodedString Class Reference

Container for an encoded string, created by GetEncodedString. More...

#include <strings_type.h>

Public Member Functions

auto operator<=> (const EncodedString &) const =default
 
std::string GetDecodedString () const
 Decode the encoded string.
 
void clear ()
 
bool empty () const
 

Private Member Functions

 EncodedString (std::string &&string)
 

Private Attributes

std::string string
 The encoded string.
 

Friends

EncodedString GetEncodedStringWithArgs (StringID str, std::span< const StringParameter > params)
 Encode a string with its parameters into an encoded string.
 

Detailed Description

Container for an encoded string, created by GetEncodedString.

Definition at line 98 of file strings_type.h.

Constructor & Destructor Documentation

◆ EncodedString()

EncodedString::EncodedString ( std::string &&  string)
inlineexplicitprivate

Definition at line 113 of file strings_type.h.

Member Function Documentation

◆ clear()

void EncodedString::clear ( )
inline

Definition at line 106 of file strings_type.h.

◆ empty()

bool EncodedString::empty ( ) const
inline

Definition at line 107 of file strings_type.h.

◆ GetDecodedString()

std::string EncodedString::GetDecodedString ( ) const

Friends And Related Symbol Documentation

◆ GetEncodedStringWithArgs

EncodedString GetEncodedStringWithArgs ( StringID  str,
std::span< const StringParameter params 
)
friend

Encode a string with its parameters into an encoded string.

The encoded string can be stored and decoded later without requiring parameters to be stored separately.

Parameters
strThe StringID to format.
paramsThe parameters of the string.
Returns
The encoded string.

Definition at line 115 of file strings.cpp.

Field Documentation

◆ string

std::string EncodedString::string
private

The encoded string.

Definition at line 110 of file strings_type.h.


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