OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
StdNamingDefaultAdapt< T, D > Struct Template Reference

#include <StdAdaptors.h>

Public Member Functions

 StdNamingDefaultAdapt (T &rValue, const char *szName, const D &rDefault, bool fPrefillDefault, bool fStoreDefault)
 
void CompileFunc (StdCompiler *pComp) const
 

Public Attributes

T & rValue
 
const char * szName
 
const D & rDefault
 
bool fPrefillDefault
 
bool fStoreDefault
 

Detailed Description

template<class T, class D>
struct StdNamingDefaultAdapt< T, D >

Definition at line 98 of file StdAdaptors.h.

Constructor & Destructor Documentation

template<class T, class D>
StdNamingDefaultAdapt< T, D >::StdNamingDefaultAdapt ( T &  rValue,
const char *  szName,
const D &  rDefault,
bool  fPrefillDefault,
bool  fStoreDefault 
)
inline

Member Function Documentation

template<class T, class D>
void StdNamingDefaultAdapt< T, D >::CompileFunc ( StdCompiler pComp) const
inline

Definition at line 102 of file StdAdaptors.h.

References StdCompiler::Default(), StdNamingDefaultAdapt< T, D >::fStoreDefault, StdCompiler::hasNaming(), StdCompiler::isDeserializer(), StdCompiler::isSerializer(), mkDefaultAdapt(), StdCompiler::Name(), StdCompiler::NameEnd(), StdNamingDefaultAdapt< T, D >::rDefault, and StdCompiler::Value().

103  {
104  // Default check
105  if (pComp->hasNaming() && pComp->isSerializer() && rValue == rDefault && !fStoreDefault)
106  {
107  if (pComp->Default(szName)) return;
108  }
109  try
110  {
111  // Search named section, set default if not found
112  if (pComp->Name(szName))
113  {
114  if (fPrefillDefault && pComp->isDeserializer()) rValue = rDefault; // default prefill if desired
116  }
117  else
118  rValue = rDefault;
119  }
120  catch (StdCompiler::Exception *)
121  {
122  pComp->NameEnd(true);
123  throw;
124  }
125  // End section
126  pComp->NameEnd();
127  }
virtual bool hasNaming()
Definition: StdCompiler.h:68
virtual bool Name(const char *szName)
Definition: StdCompiler.h:87
bool isSerializer()
Definition: StdCompiler.h:64
const char * szName
Definition: StdAdaptors.h:100
void Value(const T &rStruct)
Definition: StdCompiler.h:171
virtual bool isDeserializer()
Definition: StdCompiler.h:63
virtual bool Default(const char *szName)
Definition: StdCompiler.h:98
StdDefaultAdapt< T, D > mkDefaultAdapt(T &&rValue, const D &rDefault)
Definition: StdAdaptors.h:65
virtual void NameEnd(bool fBreak=false)
Definition: StdCompiler.h:88

Here is the call graph for this function:

Member Data Documentation

template<class T, class D>
bool StdNamingDefaultAdapt< T, D >::fPrefillDefault

Definition at line 100 of file StdAdaptors.h.

template<class T, class D>
bool StdNamingDefaultAdapt< T, D >::fStoreDefault

Definition at line 100 of file StdAdaptors.h.

Referenced by StdNamingDefaultAdapt< T, D >::CompileFunc().

template<class T, class D>
const D& StdNamingDefaultAdapt< T, D >::rDefault

Definition at line 100 of file StdAdaptors.h.

Referenced by StdNamingDefaultAdapt< T, D >::CompileFunc().

template<class T, class D>
T& StdNamingDefaultAdapt< T, D >::rValue

Definition at line 100 of file StdAdaptors.h.

template<class T, class D>
const char* StdNamingDefaultAdapt< T, D >::szName

Definition at line 100 of file StdAdaptors.h.


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