OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4GraphicsOverlayListAdapt Class Reference

#include <C4DefGraphics.h>

Collaboration diagram for C4GraphicsOverlayListAdapt:
[legend]

Public Member Functions

 C4GraphicsOverlayListAdapt (C4GraphicsOverlay *&pOverlay)
 
void CompileFunc (StdCompiler *pComp)
 
bool operator== (C4GraphicsOverlay *pDefault)
 
void operator= (C4GraphicsOverlay *pDefault)
 

Protected Attributes

C4GraphicsOverlay *& pOverlay
 

Detailed Description

Definition at line 257 of file C4DefGraphics.h.

Constructor & Destructor Documentation

C4GraphicsOverlayListAdapt::C4GraphicsOverlayListAdapt ( C4GraphicsOverlay *&  pOverlay)
inline

Definition at line 262 of file C4DefGraphics.h.

262 : pOverlay(pOverlay) { }
C4GraphicsOverlay *& pOverlay

Member Function Documentation

void C4GraphicsOverlayListAdapt::CompileFunc ( StdCompiler pComp)

Definition at line 1121 of file C4DefGraphics.cpp.

References C4GraphicsOverlay::GetNext(), StdCompiler::hasNaming(), StdCompiler::isDeserializer(), pOverlay, StdCompiler::SEP_SEP, StdCompiler::SEP_SEP2, StdCompiler::Separator(), C4GraphicsOverlay::SetNext(), and StdCompiler::Value().

1122 {
1123  bool fNaming = pComp->hasNaming();
1124  if (pComp->isDeserializer())
1125  {
1126  // clear list
1127  delete [] pOverlay; pOverlay = nullptr;
1128  // read the whole list
1129  C4GraphicsOverlay *pLast = nullptr;
1130  bool fContinue;
1131  do
1132  {
1133  C4GraphicsOverlay *pNext = new C4GraphicsOverlay();
1134  try
1135  {
1136  // read an overlay
1137  pComp->Value(*pNext);
1138  }
1140  {
1141  delete e;
1142  // delete unused overlay
1143  delete pNext; pNext = nullptr;
1144  // clear up
1145  if (!pLast) pOverlay = nullptr;
1146  // done
1147  return;
1148  }
1149  // link it
1150  if (pLast)
1151  pLast->SetNext(pNext);
1152  else
1153  pOverlay = pNext;
1154  // step
1155  pLast = pNext;
1156  // continue?
1157  if (fNaming)
1158  fContinue = pComp->Separator(StdCompiler::SEP_SEP2) || pComp->Separator(StdCompiler::SEP_SEP);
1159  else
1160  pComp->Value(fContinue);
1161  }
1162  while (fContinue);
1163  }
1164  else
1165  {
1166  // write everything
1167  bool fContinue = true;
1168  for (C4GraphicsOverlay *pPos = pOverlay; pPos; pPos = pPos->GetNext())
1169  {
1170  // separate
1171  if (pPos != pOverlay)
1172  {
1173  if (fNaming)
1175  else
1176  pComp->Value(fContinue);
1177  }
1178  // write
1179  pComp->Value(*pPos);
1180  }
1181  // terminate
1182  if (!fNaming)
1183  {
1184  fContinue = false;
1185  pComp->Value(fContinue);
1186  }
1187  }
1188 }
virtual bool Separator(Sep eSep=SEP_SEP)
Definition: StdCompiler.h:129
virtual bool hasNaming()
Definition: StdCompiler.h:68
C4GraphicsOverlay *& pOverlay
void Value(const T &rStruct)
Definition: StdCompiler.h:171
virtual bool isDeserializer()
Definition: StdCompiler.h:63
void SetNext(C4GraphicsOverlay *paNext)
C4GraphicsOverlay * GetNext() const

Here is the call graph for this function:

void C4GraphicsOverlayListAdapt::operator= ( C4GraphicsOverlay pDefault)
inline

Definition at line 266 of file C4DefGraphics.h.

References pOverlay.

266 { delete pOverlay; pOverlay = pDefault; }
C4GraphicsOverlay *& pOverlay
bool C4GraphicsOverlayListAdapt::operator== ( C4GraphicsOverlay pDefault)
inline

Definition at line 265 of file C4DefGraphics.h.

265 { return pOverlay == pDefault; }
C4GraphicsOverlay *& pOverlay

Member Data Documentation

C4GraphicsOverlay*& C4GraphicsOverlayListAdapt::pOverlay
protected

Definition at line 260 of file C4DefGraphics.h.

Referenced by CompileFunc(), and operator=().


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