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 387 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().

388 {
389  bool deserializing = pComp->isDeserializer();
390  // nothing?
391  if (!deserializing && !pDefGraphics) return;
392  // definition
393  C4ID id; if (!deserializing) id = pDefGraphics->pDef->id;
394  pComp->Value(id);
395  // go over two separators ("::"). Expect them if an id was found.
397  pComp->excCorrupt(R"(DefGraphics: expected "::")");
398  // compile name
399  StdStrBuf Name; if (!deserializing) Name = pDefGraphics->GetName();
401  // reading: search def-graphics
402  if (deserializing)
403  {
404  // search definition, throw expection if not found
405  C4Def *pDef = ::Definitions.ID2Def(id);
406  // search def-graphics
407  if (!pDef || !( pDefGraphics = pDef->Graphics.Get(Name.getData()) ))
408  pComp->excCorrupt(R"(DefGraphics: could not find graphics "%s" in %s(%s)!)", Name.getData(), id.ToString(), pDef ? pDef->GetName() : "def not found");
409  }
410 }
const char * getData() const
Definition: StdBuf.h:442
C4Def * ID2Def(C4ID id)
virtual bool Separator(Sep eSep=SEP_SEP)
Definition: StdCompiler.h:119
C4ID id
Definition: C4Def.h:101
void excCorrupt(const char *szMessage,...)
Definition: StdCompiler.h:249
const char * GetName() const override
Definition: C4PropList.cpp:267
C4DefGraphics * Get(const char *szGrpName)
C4DefGraphics *& pDefGraphics
virtual const char * GetName()
Definition: C4DefGraphics.h:79
Definition: C4Def.h:98
void Value(const T &rStruct)
Definition: StdCompiler.h:161
Definition: C4Id.h:25
virtual bool isDeserializer()
Definition: StdCompiler.h:53
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
Definition: StdAdaptors.h:458
C4DefList Definitions
Definition: C4Globals.cpp:49
StdDefaultAdapt< T, D > mkDefaultAdapt(T &&rValue, const D &rDefault)
Definition: StdAdaptors.h:64
C4DefGraphics Graphics
Definition: C4Def.h:192

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: