OpenClonk
StdArrayAdapt< T, M > Struct Template Reference

#include <StdAdaptors.h>

Public Member Functions

 StdArrayAdapt (T *pArray, int iSize, M &&map=M())
 
void CompileFunc (StdCompiler *pComp) const
 
bool operator== (const T &rDefault) const
 
StdArrayAdaptoperator= (const T &rDefault)
 
bool operator== (const T *pDefaults) const
 
StdArrayAdaptoperator= (const T *pDefaults)
 

Public Attributes

T * pArray
 
int iSize
 
M && map
 

Detailed Description

template<class T, class M = _IdFuncClass<T>>
struct StdArrayAdapt< T, M >

Definition at line 293 of file StdAdaptors.h.

Constructor & Destructor Documentation

◆ StdArrayAdapt()

template<class T , class M = _IdFuncClass<T>>
StdArrayAdapt< T, M >::StdArrayAdapt ( T *  pArray,
int  iSize,
M &&  map = M() 
)
inline

Definition at line 295 of file StdAdaptors.h.

296  : pArray(pArray), iSize(iSize), map(std::forward<M>(map))
297  { }

Member Function Documentation

◆ CompileFunc()

template<class T , class M = _IdFuncClass<T>>
void StdArrayAdapt< T, M >::CompileFunc ( StdCompiler pComp) const
inline

Definition at line 299 of file StdAdaptors.h.

300  {
301  for (int i = 0; i < iSize; i++)
302  {
303  if (i) pComp->Separator(StdCompiler::SEP_SEP);
304  pComp->Value(map(pArray[i]));
305  }
306  }
virtual bool Separator(Sep eSep=SEP_SEP)
Definition: StdCompiler.h:119
void Value(const T &rStruct)
Definition: StdCompiler.h:161

References StdArrayAdapt< T, M >::iSize, StdArrayAdapt< T, M >::map, StdArrayAdapt< T, M >::pArray, StdCompiler::SEP_SEP, StdCompiler::Separator(), and StdCompiler::Value().

Here is the call graph for this function:

◆ operator=() [1/2]

template<class T , class M = _IdFuncClass<T>>
StdArrayAdapt& StdArrayAdapt< T, M >::operator= ( const T &  rDefault)
inline

Definition at line 315 of file StdAdaptors.h.

316  {
317  for (int i = 0; i < iSize; i++)
318  pArray[i] = rDefault;
319  return *this;
320  }

References StdArrayAdapt< T, M >::iSize, and StdArrayAdapt< T, M >::pArray.

◆ operator=() [2/2]

template<class T , class M = _IdFuncClass<T>>
StdArrayAdapt& StdArrayAdapt< T, M >::operator= ( const T *  pDefaults)
inline

Definition at line 328 of file StdAdaptors.h.

329  {
330  for (int i = 0; i < iSize; i++)
331  pArray[i] = pDefaults[i];
332  return *this;
333  }

References StdArrayAdapt< T, M >::iSize, and StdArrayAdapt< T, M >::pArray.

◆ operator==() [1/2]

template<class T , class M = _IdFuncClass<T>>
bool StdArrayAdapt< T, M >::operator== ( const T &  rDefault) const
inline

Definition at line 308 of file StdAdaptors.h.

309  {
310  for (int i = 0; i < iSize; i++)
311  if (pArray[i] != rDefault)
312  return false;
313  return true;
314  }

References StdArrayAdapt< T, M >::iSize, and StdArrayAdapt< T, M >::pArray.

◆ operator==() [2/2]

template<class T , class M = _IdFuncClass<T>>
bool StdArrayAdapt< T, M >::operator== ( const T *  pDefaults) const
inline

Definition at line 321 of file StdAdaptors.h.

322  {
323  for (int i = 0; i < iSize; i++)
324  if (pArray[i] != pDefaults[i])
325  return false;
326  return true;
327  }

References StdArrayAdapt< T, M >::iSize, and StdArrayAdapt< T, M >::pArray.

Member Data Documentation

◆ iSize

template<class T , class M = _IdFuncClass<T>>
int StdArrayAdapt< T, M >::iSize

◆ map

template<class T , class M = _IdFuncClass<T>>
M&& StdArrayAdapt< T, M >::map

Definition at line 298 of file StdAdaptors.h.

Referenced by StdArrayAdapt< T, M >::CompileFunc().

◆ pArray

template<class T , class M = _IdFuncClass<T>>
T* StdArrayAdapt< T, M >::pArray

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