OpenTTD
Public Member Functions | Data Fields | Private Attributes
StringParameters Class Reference

Public Member Functions

 StringParameters (uint64 *data, uint num_param, WChar *type)
 Create a new StringParameters instance.
template<size_t Tnum_param>
 StringParameters (int64(&data)[Tnum_param])
 Create a new StringParameters instance.
 StringParameters (StringParameters &parent, uint size)
 Create a new StringParameters instance that can reference part of the data of the given partent instance.
void ClearTypeInformation ()
 Reset the type array.
int64 GetInt64 (WChar type=0)
 Read an int64 from the argument array.
int32 GetInt32 (WChar type=0)
 Read an int32 from the argument array.
void ShiftParameters (uint amount)
 Shift all data in the data array by the given amount to make room for some extra parameters.
uint64 * GetDataPointer () const
 Get a pointer to the current element in the data array.
uint GetDataLeft () const
 Return the amount of elements which can still be read.
uint64 * GetPointerToOffset (uint offset) const
 Get a pointer to a specific element in the data array.
bool HasTypeInformation () const
 Does this instance store information about the type of the parameters.
WChar GetTypeAtOffset (uint offset) const
 Get the type of a specific element.
void SetParam (uint n, uint64 v)
uint64 GetParam (uint n) const

Data Fields

uint offset
 Current offset in the data/type arrays.
uint num_param
 Length of the data array.

Private Attributes

StringParametersparent
 If not NULL, this instance references data from this parent instance.
uint64 * data
 Array with the actual data.
WChartype
 Array with type information about the data. Can be NULL when no type information is needed. See StringControlCode.

Detailed Description

Definition at line 19 of file strings_func.h.

Constructor & Destructor Documentation

StringParameters::StringParameters ( uint64 *  data,
uint  num_param,
WChar type 
)
inline

Create a new StringParameters instance.

Definition at line 29 of file strings_func.h.

template<size_t Tnum_param>
StringParameters::StringParameters ( int64(&)  data[Tnum_param])
inline

Create a new StringParameters instance.

Definition at line 39 of file strings_func.h.

References data.

Member Function Documentation

void StringParameters::ClearTypeInformation ( )

Reset the type array.

Definition at line 61 of file strings.cpp.

References MemSetT(), num_param, and type.

Referenced by FormatString().

uint StringParameters::GetDataLeft ( ) const
inline

Return the amount of elements which can still be read.

Definition at line 93 of file strings_func.h.

References num_param, and offset.

Referenced by FormatString(), and StringParameters().

uint64* StringParameters::GetDataPointer ( ) const
inline

Get a pointer to the current element in the data array.

Definition at line 87 of file strings_func.h.

References data, and offset.

Referenced by FormatString().

int32 StringParameters::GetInt32 ( WChar  type = 0)
inline

Read an int32 from the argument array.

See Also
GetInt64.

Definition at line 79 of file strings_func.h.

References GetInt64(), and type.

Referenced by FormatString(), and GetStringWithArgs().

int64 StringParameters::GetInt64 ( WChar  type = 0)

Read an int64 from the argument array.

The offset is increased so the next time GetInt64 is called the next value is read.

Definition at line 72 of file strings.cpp.

References data, DEBUG, num_param, offset, and type.

Referenced by FormatString(), and GetInt32().

uint64* StringParameters::GetPointerToOffset ( uint  offset) const
inline

Get a pointer to a specific element in the data array.

Definition at line 99 of file strings_func.h.

References data, num_param, and offset.

Referenced by CopyInDParam(), CopyOutDParam(), and FormatString().

WChar StringParameters::GetTypeAtOffset ( uint  offset) const
inline

Get the type of a specific element.

Definition at line 112 of file strings_func.h.

References HasTypeInformation(), num_param, offset, and type.

Referenced by CopyOutDParam(), and FormatString().

bool StringParameters::HasTypeInformation ( ) const
inline

Does this instance store information about the type of the parameters.

Definition at line 106 of file strings_func.h.

References type.

Referenced by CopyOutDParam(), FormatString(), and GetTypeAtOffset().


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