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 285 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 287 of file StdAdaptors.h.

288  : pArray(pArray), iSize(iSize), map(std::forward<M>(map))
289  { }

Member Function Documentation

◆ CompileFunc()

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

Definition at line 291 of file StdAdaptors.h.

References iSize, StdCompiler::SEP_SEP, StdCompiler::Separator(), and StdCompiler::Value().

292  {
293  for (int i = 0; i < iSize; i++)
294  {
295  if (i) pComp->Separator(StdCompiler::SEP_SEP);
296  pComp->Value(map(pArray[i]));
297  }
298  }
virtual bool Separator(Sep eSep=SEP_SEP)
Definition: StdCompiler.h:119
void Value(const T &rStruct)
Definition: StdCompiler.h:161
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 307 of file StdAdaptors.h.

References iSize.

308  {
309  for (int i = 0; i < iSize; i++)
310  pArray[i] = rDefault;
311  return *this;
312  }

◆ operator=() [2/2]

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

Definition at line 320 of file StdAdaptors.h.

References iSize.

321  {
322  for (int i = 0; i < iSize; i++)
323  pArray[i] = pDefaults[i];
324  return *this;
325  }

◆ operator==() [1/2]

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

Definition at line 300 of file StdAdaptors.h.

References iSize.

301  {
302  for (int i = 0; i < iSize; i++)
303  if (pArray[i] != rDefault)
304  return false;
305  return true;
306  }

◆ operator==() [2/2]

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

Definition at line 313 of file StdAdaptors.h.

References iSize.

314  {
315  for (int i = 0; i < iSize; i++)
316  if (pArray[i] != pDefaults[i])
317  return false;
318  return true;
319  }

Member Data Documentation

◆ iSize

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

Definition at line 290 of file StdAdaptors.h.

◆ map

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

Definition at line 290 of file StdAdaptors.h.

◆ pArray

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

Definition at line 290 of file StdAdaptors.h.


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