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

#include <C4DefGraphics.h>

Collaboration diagram for C4DefGraphicsAdapt:
[legend]

Public Member Functions

 C4DefGraphicsAdapt (C4DefGraphics *&pDefGraphics)
 
void CompileFunc (StdCompiler *pComp)
 
bool operator== (C4DefGraphics *pDef2)
 
void operator= (C4DefGraphics *pDef2)
 

Protected Attributes

C4DefGraphics *& pDefGraphics
 

Detailed Description

Definition at line 151 of file C4DefGraphics.h.

Constructor & Destructor Documentation

C4DefGraphicsAdapt::C4DefGraphicsAdapt ( C4DefGraphics *&  pDefGraphics)
inline

Definition at line 156 of file C4DefGraphics.h.

156 : pDefGraphics(pDefGraphics) { }
C4DefGraphics *& pDefGraphics

Member Function Documentation

void C4DefGraphicsAdapt::CompileFunc ( StdCompiler pComp)

Definition at line 391 of file C4DefGraphics.cpp.

References Definitions, StdCompiler::excCorrupt(), C4DefGraphics::Get(), StdStrBuf::getData(), C4DefGraphics::GetName(), C4PropListStatic::GetName(), C4Def::Graphics, C4Def::id, C4DefList::ID2Def(), StdCompiler::isDeserializer(), mkDefaultAdapt(), mkParAdapt(), C4DefGraphics::pDef, pDefGraphics, StdCompiler::RCT_Idtf, StdCompiler::SEP_PART2, StdCompiler::Separator(), and StdCompiler::Value().

392 {
393  bool deserializing = pComp->isDeserializer();
394  // nothing?
395  if (!deserializing && !pDefGraphics) return;
396  // definition
397  C4ID id; if (!deserializing) id = pDefGraphics->pDef->id;
398  pComp->Value(id);
399  // go over two separators ("::"). Expect them if an id was found.
401  pComp->excCorrupt("DefGraphics: expected \"::\"");
402  // compile name
403  StdStrBuf Name; if (!deserializing) Name = pDefGraphics->GetName();
405  // reading: search def-graphics
406  if (deserializing)
407  {
408  // search definition, throw expection if not found
409  C4Def *pDef = ::Definitions.ID2Def(id);
410  // search def-graphics
411  if (!pDef || !( pDefGraphics = pDef->Graphics.Get(Name.getData()) ))
412  pComp->excCorrupt("DefGraphics: could not find graphics \"%s\" in %s(%s)!", Name.getData(), id.ToString(), pDef ? pDef->GetName() : "def not found");
413  }
414 }
const char * getData() const
Definition: StdBuf.h:450
C4Def * ID2Def(C4ID id)
virtual bool Separator(Sep eSep=SEP_SEP)
Definition: StdCompiler.h:129
C4ID id
Definition: C4Def.h:103
virtual const char * GetName() const
Definition: C4PropList.cpp:267
void excCorrupt(const char *szMessage,...)
Definition: StdCompiler.h:259
C4DefGraphics * Get(const char *szGrpName)
C4DefGraphics *& pDefGraphics
virtual const char * GetName()
Definition: C4DefGraphics.h:79
Definition: C4Def.h:100
void Value(const T &rStruct)
Definition: StdCompiler.h:171
Definition: C4Id.h:28
virtual bool isDeserializer()
Definition: StdCompiler.h:63
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
Definition: StdAdaptors.h:456
C4DefList Definitions
Definition: C4Globals.cpp:49
StdDefaultAdapt< T, D > mkDefaultAdapt(T &&rValue, const D &rDefault)
Definition: StdAdaptors.h:65
C4DefGraphics Graphics
Definition: C4Def.h:194

Here is the call graph for this function:

void C4DefGraphicsAdapt::operator= ( C4DefGraphics pDef2)
inline

Definition at line 160 of file C4DefGraphics.h.

160 { pDefGraphics = pDef2; }
C4DefGraphics *& pDefGraphics
bool C4DefGraphicsAdapt::operator== ( C4DefGraphics pDef2)
inline

Definition at line 159 of file C4DefGraphics.h.

159 { return pDefGraphics == pDef2; }
C4DefGraphics *& pDefGraphics

Member Data Documentation

C4DefGraphics*& C4DefGraphicsAdapt::pDefGraphics
protected

Definition at line 154 of file C4DefGraphics.h.

Referenced by CompileFunc().


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