OpenTTD Source 20241224-master-gf74b0cf984
ArrayStringParameters< N > Class Template Reference

Extension of StringParameters with its own statically sized buffer for the parameters. More...

#include <strings_internal.h>

Inheritance diagram for ArrayStringParameters< N >:
StringParameters

Public Member Functions

 ArrayStringParameters (ArrayStringParameters &&other) noexcept
 
ArrayStringParametersoperator= (ArrayStringParameters &&other) noexcept
 
 ArrayStringParameters (const ArrayStringParameters &other)=delete
 
ArrayStringParametersoperator= (const ArrayStringParameters &other)=delete
 
- Public Member Functions inherited from StringParameters
 StringParameters (StringParameters &parent, size_t size)
 Create a new StringParameters instance that can reference part of the data of the given parent instance.
 
void PrepareForNextRun ()
 Prepare the string parameters for the next formatting run.
 
void SetTypeOfNextParameter (char32_t type)
 
size_t GetOffset ()
 Get the current offset, so it can be backed up for certain processing steps, or be used to offset the argument index within sub strings.
 
void SetOffset (size_t offset)
 Set the offset within the string from where to return the next result of GetInt64 or GetInt32.
 
void AdvanceOffset (size_t advance)
 Advance the offset within the string from where to return the next result of GetInt64 or GetInt32.
 
template<typename T >
GetNextParameter ()
 Get the next parameter from our parameters.
 
const char * GetNextParameterString ()
 Get the next string parameter from our parameters.
 
StringParameters GetRemainingParameters ()
 Get a new instance of StringParameters that is a "range" into the remaining existing parameters.
 
StringParameters GetRemainingParameters (size_t offset)
 Get a new instance of StringParameters that is a "range" into the remaining existing parameters from the given offset.
 
size_t GetDataLeft () const
 Return the amount of elements which can still be read.
 
char32_t GetTypeAtOffset (size_t offset) const
 Get the type of a specific element.
 
void SetParam (size_t n, const StringParameterData &v)
 
void SetParam (size_t n, uint64_t v)
 
template<typename T , std::enable_if_t< std::is_base_of< StrongTypedefBase, T >::value, int > = 0>
void SetParam (size_t n, T v)
 
void SetParam (size_t n, const char *str)
 
void SetParam (size_t n, const std::string &str)
 
void SetParam (size_t n, std::string &&str)
 
const StringParameterData & GetParam (size_t n) const
 

Private Attributes

std::array< StringParameter, N > params {}
 The actual parameters.
 

Additional Inherited Members

- Protected Member Functions inherited from StringParameters
 StringParameters (std::span< StringParameter > parameters={})
 
const StringParameterGetNextParameterReference ()
 Get the next parameter from our parameters.
 
- Protected Attributes inherited from StringParameters
StringParametersparent = nullptr
 If not nullptr, this instance references data from this parent instance.
 
std::span< StringParameterparameters = {}
 Array with the actual parameters.
 
size_t offset = 0
 Current offset in the parameters span.
 
char32_t next_type = 0
 The type of the next data that is retrieved.
 

Detailed Description

template<size_t N>
class ArrayStringParameters< N >

Extension of StringParameters with its own statically sized buffer for the parameters.

Definition at line 202 of file strings_internal.h.

Constructor & Destructor Documentation

◆ ArrayStringParameters() [1/2]

template<size_t N>
ArrayStringParameters< N >::ArrayStringParameters ( )
inline

Definition at line 206 of file strings_internal.h.

◆ ArrayStringParameters() [2/2]

template<size_t N>
ArrayStringParameters< N >::ArrayStringParameters ( ArrayStringParameters< N > &&  other)
inlinenoexcept

Definition at line 211 of file strings_internal.h.

Member Function Documentation

◆ operator=()

template<size_t N>
ArrayStringParameters & ArrayStringParameters< N >::operator= ( ArrayStringParameters< N > &&  other)
inlinenoexcept

Definition at line 216 of file strings_internal.h.

Field Documentation

◆ params

template<size_t N>
std::array<StringParameter, N> ArrayStringParameters< N >::params {}
private

The actual parameters.

Definition at line 203 of file strings_internal.h.


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