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 97 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 101 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().

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

Here is the call graph for this function:

Member Data Documentation

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

Definition at line 99 of file StdAdaptors.h.

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

Definition at line 99 of file StdAdaptors.h.

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

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

Definition at line 99 of file StdAdaptors.h.

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

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

Definition at line 99 of file StdAdaptors.h.

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

Definition at line 99 of file StdAdaptors.h.


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