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 256 of file C4DefGraphics.h.

Constructor & Destructor Documentation

C4GraphicsOverlayListAdapt::C4GraphicsOverlayListAdapt ( C4GraphicsOverlay *&  pOverlay)
inline

Definition at line 261 of file C4DefGraphics.h.

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

Member Function Documentation

void C4GraphicsOverlayListAdapt::CompileFunc ( StdCompiler pComp)

Definition at line 1116 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().

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

Here is the call graph for this function:

void C4GraphicsOverlayListAdapt::operator= ( C4GraphicsOverlay pDefault)
inline

Definition at line 265 of file C4DefGraphics.h.

References pOverlay.

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

Definition at line 264 of file C4DefGraphics.h.

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

Member Data Documentation

C4GraphicsOverlay*& C4GraphicsOverlayListAdapt::pOverlay
protected

Definition at line 259 of file C4DefGraphics.h.

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


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