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

#include <StdCompiler.h>

Inheritance diagram for StdCompilerBinRead:
[legend]
Collaboration diagram for StdCompilerBinRead:
[legend]

Public Types

typedef StdBuf InT
 
enum  Sep {
  SEP_NONE =0, SEP_SEP, SEP_SEP2, SEP_SET,
  SEP_PART, SEP_PART2, SEP_PLUS, SEP_START,
  SEP_END, SEP_START2, SEP_END2, SEP_VLINE,
  SEP_DOLLAR
}
 
enum  RawCompileType {
  RCT_Escaped =0, RCT_All, RCT_Idtf, RCT_IdtfAllowEmpty,
  RCT_ID
}
 
typedef void(* WarnCBT )(void *, const char *, const char *)
 

Public Member Functions

void setInput (InT &&In)
 
virtual bool isDeserializer ()
 
virtual void DWord (int32_t &rInt)
 
virtual void DWord (uint32_t &rInt)
 
virtual void Word (int16_t &rShort)
 
virtual void Word (uint16_t &rShort)
 
virtual void Byte (int8_t &rByte)
 
virtual void Byte (uint8_t &rByte)
 
virtual void Boolean (bool &rBool)
 
virtual void Character (char &rChar)
 
virtual void String (char *szString, size_t iMaxLength, RawCompileType eType=RCT_Escaped)
 
virtual void String (char **pszString, RawCompileType eType=RCT_Escaped)
 
virtual void Raw (void *pData, size_t iSize, RawCompileType eType=RCT_Escaped)
 
virtual StdStrBuf getPosition () const
 
virtual void Begin ()
 
size_t getPosition ()
 
size_t getRemainingBytes ()
 
virtual bool isDoublePass ()
 
bool isSerializer ()
 
virtual bool hasNaming ()
 
virtual bool isVerbose ()
 
virtual bool isRegistry ()
 
virtual void setRuntimeWritesAllowed (int32_t iChange)
 
virtual bool Name (const char *szName)
 
virtual void NameEnd (bool fBreak=false)
 
virtual const char * GetNameByIndex (size_t idx) const
 
virtual bool FollowName (const char *szName)
 
virtual bool Default (const char *szName)
 
virtual int NameCount (const char *szName=nullptr)
 
virtual bool Separator (Sep eSep=SEP_SEP)
 
virtual void NoSeparator ()
 
virtual void BeginSecond ()
 
virtual void End ()
 
template<class T >
void Value (const T &rStruct)
 
template<class T >
void Value (T &rStruct)
 
void Value (int32_t &rInt)
 
void Value (uint32_t &rInt)
 
void Value (int16_t &rInt)
 
void Value (uint16_t &rInt)
 
void Value (int8_t &rInt)
 
void Value (uint8_t &rInt)
 
void Value (bool &rBool)
 
template<class T >
void Compile (T &&rStruct)
 
template<class T >
void Decompile (const T &rStruct)
 
void excNotFound (const char *szMessage,...)
 
void excEOF (const char *szMessage="EOF",...)
 
void excCorrupt (const char *szMessage,...)
 
void setWarnCallback (WarnCBT pnWarnCB, void *pData)
 
void Warn (const char *szWarning,...)
 

Protected Member Functions

template<class T >
void ReadValue (T &rValue)
 
template<class T >
void DoCompilation (T &rStruct)
 

Static Protected Member Functions

static char SeparatorToChar (Sep eSep)
 

Protected Attributes

size_t iPos
 
StdBuf Buf
 

Detailed Description

Definition at line 487 of file StdCompiler.h.

Member Typedef Documentation

Definition at line 492 of file StdCompiler.h.

typedef void(* StdCompiler::WarnCBT)(void *, const char *, const char *)
inherited

Definition at line 290 of file StdCompiler.h.

Member Enumeration Documentation

Enumerator
RCT_Escaped 
RCT_All 
RCT_Idtf 
RCT_IdtfAllowEmpty 
RCT_ID 

Definition at line 145 of file StdCompiler.h.

146  {
147  RCT_Escaped=0,// Any data allowed, no separator needed (default)
148  RCT_All, // Printable characters only, must be last element in naming.
149  RCT_Idtf, // Alphanumerical characters or '_', separator needed.
150  RCT_IdtfAllowEmpty, // Like RCT_Idtf, but empty strings are also allowed
151  RCT_ID // Like RCT_Idtf (only used for special compilers that treat IDs differently)
152  };
enum StdCompiler::Sep
inherited
Enumerator
SEP_NONE 
SEP_SEP 
SEP_SEP2 
SEP_SET 
SEP_PART 
SEP_PART2 
SEP_PLUS 
SEP_START 
SEP_END 
SEP_START2 
SEP_END2 
SEP_VLINE 
SEP_DOLLAR 

Definition at line 113 of file StdCompiler.h.

114  {
115  SEP_NONE=0, // No separator ("")
116  SEP_SEP, // Array separation (",")
117  SEP_SEP2, // Array separation 2 (";")
118  SEP_SET, // Map pair separation ("=")
119  SEP_PART, // Value part separation (".")
120  SEP_PART2, // Value part separation 2 (":")
121  SEP_PLUS, // Value separation with a '+' char ("+")
122  SEP_START, // Start some sort of list ('(')
123  SEP_END, // End some sort of list ('(')
124  SEP_START2, // Start some sort of list ('[')
125  SEP_END2, // End some sort of list (']')
126  SEP_VLINE, // Vertical line separator ('|')
127  SEP_DOLLAR // Dollar sign ('$')
128  };

Member Function Documentation

void StdCompilerBinRead::Begin ( )
virtual

Reimplemented from StdCompiler.

Definition at line 180 of file StdCompiler.cpp.

References iPos.

Referenced by C4Playback::ReadBinary().

181 {
182  iPos = 0;
183 }

Here is the caller graph for this function:

virtual void StdCompiler::BeginSecond ( )
inlinevirtualinherited

Reimplemented in StdCompilerBinWrite.

Definition at line 164 of file StdCompiler.h.

Referenced by StdCompiler::DoCompilation().

164 { }

Here is the caller graph for this function:

void StdCompilerBinRead::Boolean ( bool &  rBool)
virtual

Implements StdCompiler.

Definition at line 124 of file StdCompiler.cpp.

References ReadValue().

124 { ReadValue(rBool); }
void ReadValue(T &rValue)

Here is the call graph for this function:

void StdCompilerBinRead::Byte ( int8_t &  rByte)
virtual

Implements StdCompiler.

Definition at line 122 of file StdCompiler.cpp.

References ReadValue().

122 { ReadValue(rByte); }
void ReadValue(T &rValue)

Here is the call graph for this function:

void StdCompilerBinRead::Byte ( uint8_t &  rByte)
virtual

Implements StdCompiler.

Definition at line 123 of file StdCompiler.cpp.

References ReadValue().

123 { ReadValue(rByte); }
void ReadValue(T &rValue)

Here is the call graph for this function:

void StdCompilerBinRead::Character ( char &  rChar)
virtual

Implements StdCompiler.

Definition at line 125 of file StdCompiler.cpp.

References ReadValue().

125 { ReadValue(rChar); }
void ReadValue(T &rValue)

Here is the call graph for this function:

template<class T >
void StdCompiler::Compile ( T &&  rStruct)
inlineinherited

Definition at line 182 of file StdCompiler.h.

References StdCompiler::DoCompilation(), and StdCompiler::isDeserializer().

Referenced by C4Config::Default(), C4GameParameters::Load(), C4Config::Load(), C4ConfigGamepad::Reset(), and C4ConfigGamepad::ResetButtons().

183  {
184  assert(isDeserializer());
185  DoCompilation(rStruct);
186  }
void DoCompilation(T &rStruct)
Definition: StdCompiler.h:197
virtual bool isDeserializer()
Definition: StdCompiler.h:63

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T >
void StdCompiler::Decompile ( const T &  rStruct)
inlineinherited

Definition at line 187 of file StdCompiler.h.

References StdCompiler::DoCompilation(), and StdCompiler::isDeserializer().

Referenced by GetValByStdCompiler(), and C4Config::Save().

188  {
189  assert(!isDeserializer());
190  DoCompilation(const_cast<T &>(rStruct));
191  }
void DoCompilation(T &rStruct)
Definition: StdCompiler.h:197
virtual bool isDeserializer()
Definition: StdCompiler.h:63

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool StdCompiler::Default ( const char *  szName)
inlinevirtualinherited

Reimplemented in C4ValueCompiler.

Definition at line 98 of file StdCompiler.h.

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

98 { return true; }

Here is the caller graph for this function:

template<class T >
void StdCompiler::DoCompilation ( T &  rStruct)
inlineprotectedinherited

Definition at line 197 of file StdCompiler.h.

References StdCompiler::Begin(), StdCompiler::BeginSecond(), StdCompiler::End(), StdCompiler::isDoublePass(), and StdCompiler::Value().

Referenced by StdCompiler::Compile(), and StdCompiler::Decompile().

198  {
199  // Start compilation, do first pass
200  Begin();
201  Value(rStruct);
202  // Second pass needed?
203  if (isDoublePass())
204  {
205  BeginSecond();
206  Value(rStruct);
207  }
208  // Finish
209  End();
210  }
virtual void End()
Definition: StdCompiler.h:165
virtual bool isDoublePass()
Definition: StdCompiler.h:60
void Value(const T &rStruct)
Definition: StdCompiler.h:170
virtual void Begin()
Definition: StdCompiler.h:163
virtual void BeginSecond()
Definition: StdCompiler.h:164

Here is the call graph for this function:

Here is the caller graph for this function:

void StdCompilerBinRead::DWord ( int32_t &  rInt)
virtual

Implements StdCompiler.

Definition at line 118 of file StdCompiler.cpp.

References ReadValue().

118 { ReadValue(rInt); }
void ReadValue(T &rValue)

Here is the call graph for this function:

void StdCompilerBinRead::DWord ( uint32_t &  rInt)
virtual

Implements StdCompiler.

Definition at line 119 of file StdCompiler.cpp.

References ReadValue().

119 { ReadValue(rInt); }
void ReadValue(T &rValue)

Here is the call graph for this function:

virtual void StdCompiler::End ( )
inlinevirtualinherited

Reimplemented in StdCompilerINIRead, and StdCompilerINIWrite.

Definition at line 165 of file StdCompiler.h.

Referenced by StdCompiler::DoCompilation(), and C4Playback::ReadBinary().

165 { }

Here is the caller graph for this function:

void StdCompiler::excCorrupt ( const char *  szMessage,
  ... 
)
inlineinherited

Definition at line 258 of file StdCompiler.h.

References FormatStringV(), and StdCompiler::getPosition().

Referenced by C4MeshDenumerator::CompileFunc(), C4Network2ResCore::CompileFunc(), C4RoundResultsPlayers::CompileFunc(), C4DefGraphicsAdapt::CompileFunc(), C4Network2ResChunkData::CompileFunc(), C4Value::CompileFunc(), C4PropListNumbered::CompileFunc(), C4KeyCodeEx::CompileFunc(), StdSubMeshInstance::CompileFunc(), C4IDPacket::CompileFunc(), C4ClientPlayerInfos::CompileFunc(), StdMeshInstanceAnimationNode::CompileFunc(), C4PlayerInfoList::CompileFunc(), StdMeshInstance::CompileFunc(), C4ValueNumbers::CompileValue(), C4PropListStatic::RefCompileFunc(), and String().

259  {
260  // Throw the appropriate exception
261  va_list args; va_start(args, szMessage);
262  throw new CorruptException(getPosition(), FormatStringV(szMessage, args));
263  }
virtual StdStrBuf getPosition() const
Definition: StdCompiler.h:160
StdStrBuf FormatStringV(const char *szFmt, va_list args)
Definition: StdBuf.cpp:283

Here is the call graph for this function:

Here is the caller graph for this function:

void StdCompiler::excEOF ( const char *  szMessage = "EOF",
  ... 
)
inlineinherited

Definition at line 252 of file StdCompiler.h.

References FormatStringV(), and StdCompiler::getPosition().

Referenced by Raw(), ReadValue(), and String().

253  {
254  // Throw the appropriate exception
255  va_list args; va_start(args, szMessage);
256  throw new EOFException(getPosition(), FormatStringV(szMessage, args));
257  }
virtual StdStrBuf getPosition() const
Definition: StdCompiler.h:160
StdStrBuf FormatStringV(const char *szFmt, va_list args)
Definition: StdBuf.cpp:283

Here is the call graph for this function:

Here is the caller graph for this function:

void StdCompiler::excNotFound ( const char *  szMessage,
  ... 
)
inlineinherited

Definition at line 242 of file StdCompiler.h.

References FormatStringV(), and StdCompiler::getPosition().

Referenced by C4ScenarioParameterDef::Option::CompileFunc(), C4PlayerControlDef::CompileFunc(), C4ScenarioParameterDef::CompileFunc(), C4PlayerControlAssignment::CompileFunc(), C4Object::CompileFunc(), C4PlayerControlAssignmentSet::CompileFunc(), StdHexAdapt::CompileFunc(), and StdCompilerINIRead::notFound().

243  {
244 #ifdef STDCOMPILER_EXCEPTION_WORKAROUND
245  // Exception workaround: Just set a flag in failesafe mode.
246  if (fFailSafe) { fFail = true; return; }
247 #endif
248  // Throw the appropriate exception
249  va_list args; va_start(args, szMessage);
250  throw new NotFoundException(getPosition(), FormatStringV(szMessage, args));
251  }
virtual StdStrBuf getPosition() const
Definition: StdCompiler.h:160
StdStrBuf FormatStringV(const char *szFmt, va_list args)
Definition: StdBuf.cpp:283

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool StdCompiler::FollowName ( const char *  szName)
inlinevirtualinherited

Reimplemented in StdCompilerINIRead.

Definition at line 94 of file StdCompiler.h.

References StdCompiler::Name(), and StdCompiler::NameEnd().

Referenced by C4Object::CompileFunc().

94 { NameEnd(); return Name(szName); }
virtual bool Name(const char *szName)
Definition: StdCompiler.h:87
virtual void NameEnd(bool fBreak=false)
Definition: StdCompiler.h:88

Here is the call graph for this function:

Here is the caller graph for this function:

virtual const char* StdCompiler::GetNameByIndex ( size_t  idx) const
inlinevirtualinherited

Reimplemented in StdCompilerINIRead.

Definition at line 89 of file StdCompiler.h.

Referenced by C4ScenarioParameters::CompileFunc().

89 { return nullptr; }

Here is the caller graph for this function:

StdStrBuf StdCompilerBinRead::getPosition ( ) const
virtual

Reimplemented from StdCompiler.

Definition at line 164 of file StdCompiler.cpp.

References FormatString(), and iPos.

Referenced by C4Playback::ReadBinary().

165 {
166  return FormatString("byte %ld", static_cast<unsigned long>(iPos));
167 }
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:277

Here is the call graph for this function:

Here is the caller graph for this function:

size_t StdCompilerBinRead::getPosition ( )
inline

Definition at line 518 of file StdCompiler.h.

References iPos.

518 { return iPos; }
size_t StdCompilerBinRead::getRemainingBytes ( )
inline

Definition at line 519 of file StdCompiler.h.

References Buf, StdBuf::getSize(), and iPos.

519 { return Buf.getSize() - iPos; }
size_t getSize() const
Definition: StdBuf.h:109

Here is the call graph for this function:

virtual bool StdCompilerBinRead::isDeserializer ( )
inlinevirtual

Reimplemented from StdCompiler.

Definition at line 496 of file StdCompiler.h.

496 { return true; }
virtual bool StdCompiler::isDoublePass ( )
inlinevirtualinherited

Reimplemented in StdCompilerBinWrite.

Definition at line 60 of file StdCompiler.h.

Referenced by StdCompiler::DoCompilation().

60 { return false; }

Here is the caller graph for this function:

virtual bool StdCompiler::isRegistry ( )
inlinevirtualinherited

Definition at line 75 of file StdCompiler.h.

Referenced by C4PlayerControlAssignmentSets::CompileFunc().

75 { return false; }

Here is the caller graph for this function:

bool StdCompiler::isSerializer ( )
inlineinherited

Definition at line 64 of file StdCompiler.h.

References StdCompiler::isDeserializer().

Referenced by C4NetFilenameAdapt::CompileFunc(), C4ID::CompileFunc(), C4Command::CompileFunc(), StdNamingDefaultAdapt< T, D >::CompileFunc(), C4ObjectList::CompileFunc(), C4Effect::CompileFunc(), C4FoWLightSection::CompileFunc(), StdDecompileAdapt< T >::CompileFunc(), C4PlayerInfo::CompileFunc(), C4Game::CompileFunc(), and C4PlayerControlAssignmentSets::CompileFunc().

64 { return !isDeserializer(); }
virtual bool isDeserializer()
Definition: StdCompiler.h:63

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool StdCompiler::isVerbose ( )
inlinevirtualinherited

Reimplemented in C4ValueCompiler.

Definition at line 72 of file StdCompiler.h.

References StdCompiler::hasNaming().

Referenced by StdEnumAdapt< T, int_t >::CompileFunc(), StdBitfieldAdapt< T >::CompileFunc(), and StdHexAdapt::CompileFunc().

72 { return hasNaming(); }
virtual bool hasNaming()
Definition: StdCompiler.h:68

Here is the call graph for this function:

Here is the caller graph for this function:

virtual int StdCompiler::NameCount ( const char *  szName = nullptr)
inlinevirtualinherited

Reimplemented in StdCompilerINIRead, and StdCompilerNull.

Definition at line 101 of file StdCompiler.h.

Referenced by C4ScenarioParameters::CompileFunc(), and StdNamingCountAdapt< int_t >::CompileFunc().

101 { assert(false); return 0; }

Here is the caller graph for this function:

virtual void StdCompiler::NoSeparator ( )
inlinevirtualinherited

Reimplemented in StdCompilerINIRead.

Definition at line 130 of file StdCompiler.h.

Referenced by C4Command::CompileFunc(), and C4KeyCodeEx::CompileFunc().

130 { }

Here is the caller graph for this function:

void StdCompilerBinRead::Raw ( void *  pData,
size_t  iSize,
RawCompileType  eType = RCT_Escaped 
)
virtual

Implements StdCompiler.

Definition at line 155 of file StdCompiler.cpp.

References Buf, StdCompiler::excEOF(), StdBuf::getPtr(), StdBuf::getSize(), iPos, and iSize.

156 {
157  if (iPos + iSize > Buf.getSize())
158  { excEOF(); return; }
159  // Copy data
160  memcpy(pData, Buf.getPtr(iPos), iSize);
161  iPos += iSize;
162 }
void excEOF(const char *szMessage="EOF",...)
Definition: StdCompiler.h:252
size_t getSize() const
Definition: StdBuf.h:109
const void * getPtr(size_t i) const
Definition: StdBuf.h:112
int iSize
Definition: TstC4NetIO.cpp:35

Here is the call graph for this function:

template<class T >
void StdCompilerBinRead::ReadValue ( T &  rValue)
inlineprotected

Definition at line 170 of file StdCompiler.cpp.

References Buf, StdCompiler::excEOF(), StdBuf::getSize(), and iPos.

Referenced by Boolean(), Byte(), Character(), DWord(), and Word().

171 {
172  // Pufferüberhang prüfen
173  if (iPos + sizeof(T) > Buf.getSize())
174  { excEOF(); return; }
175  // Kopieren
176  rValue = *getBufPtr<T>(Buf, iPos);
177  iPos += sizeof(T);
178 }
void excEOF(const char *szMessage="EOF",...)
Definition: StdCompiler.h:252
size_t getSize() const
Definition: StdBuf.h:109

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool StdCompiler::Separator ( Sep  eSep = SEP_SEP)
inlinevirtualinherited

Reimplemented in StdCompilerINIRead, and StdCompilerINIWrite.

Definition at line 129 of file StdCompiler.h.

Referenced by C4GameVersion::CompileFunc(), C4SVal::CompileFunc(), C4NameList::CompileFunc(), C4Property::CompileFunc(), C4Network2Address::CompileFunc(), C4ValueProviderLinear::CompileFunc(), C4ValueArray::CompileFunc(), C4ValueMapData::CompileFunc(), C4Rect::CompileFunc(), C4ValueProviderX::CompileFunc(), C4TargetRect::CompileFunc(), C4Command::CompileFunc(), C4ValueProviderY::CompileFunc(), C4DrawTransform::CompileFunc(), C4ValueProviderR::CompileFunc(), C4Effect::CompileFunc(), C4ValueProviderAbsX::CompileFunc(), C4PropList::CompileFunc(), C4ValueProviderAbsY::CompileFunc(), C4DefGraphicsAdapt::CompileFunc(), C4ValueProviderDist::CompileFunc(), C4MessageBoardQuery::CompileFunc(), C4Network2ResChunkData::CompileFunc(), C4ValueProviderXDir::CompileFunc(), C4Set< T >::CompileFunc(), C4ValueProviderYDir::CompileFunc(), C4GraphicsOverlay::CompileFunc(), C4Value::CompileFunc(), C4ControlPlayerControl::ControlItem::CompileFunc(), C4PropListNumbered::CompileFunc(), C4ValueProviderRDir::CompileFunc(), C4KeyCodeEx::CompileFunc(), C4ValueProviderAbsRDir::CompileFunc(), C4KeyEventData::CompileFunc(), C4ValueProviderCosR::CompileFunc(), C4GraphicsOverlayListAdapt::CompileFunc(), C4ValueNumbers::CompileFunc(), StdArrayAdapt< T, M >::CompileFunc(), C4ValueProviderSinR::CompileFunc(), C4ValueProviderCosV::CompileFunc(), C4ValueProviderSinV::CompileFunc(), StdArrayDefaultAdapt< T, D, M >::CompileFunc(), C4ValueProviderAction::CompileFunc(), StdBuf::CompileFunc(), C4PlayerControl::CSync::ControlDownState::CompileFunc(), StdArrayDefaultArrayAdapt< T, D, M >::CompileFunc(), StdSTLContainerAdapt< C >::CompileFunc(), StdBitfieldAdapt< T >::CompileFunc(), C4ValueNumbers::CompileValue(), and C4PropListStatic::RefCompileFunc().

129 { return true; }

Here is the caller graph for this function:

char StdCompiler::SeparatorToChar ( Sep  eSep)
staticprotectedinherited

Definition at line 37 of file StdCompiler.cpp.

References StdCompiler::SEP_DOLLAR, StdCompiler::SEP_END, StdCompiler::SEP_END2, StdCompiler::SEP_PART, StdCompiler::SEP_PART2, StdCompiler::SEP_PLUS, StdCompiler::SEP_SEP, StdCompiler::SEP_SEP2, StdCompiler::SEP_SET, StdCompiler::SEP_START, StdCompiler::SEP_START2, and StdCompiler::SEP_VLINE.

Referenced by StdCompilerINIWrite::Separator(), and StdCompilerINIRead::Separator().

38 {
39  switch (eSep)
40  {
41  case SEP_SEP: return ',';
42  case SEP_SEP2: return ';';
43  case SEP_SET: return '=';
44  case SEP_PART: return '.';
45  case SEP_PART2: return ':';
46  case SEP_PLUS: return '+';
47  case SEP_START: return '(';
48  case SEP_END: return ')';
49  case SEP_START2: return '[';
50  case SEP_END2: return ']';
51  case SEP_VLINE: return '|';
52  case SEP_DOLLAR: return '$';
53  default: assert(!"Unhandled Separator value");
54  }
55  return ' ';
56 }

Here is the caller graph for this function:

void StdCompilerBinRead::setInput ( InT &&  In)
inline

Definition at line 493 of file StdCompiler.h.

References Buf.

Referenced by C4Playback::ReadBinary().

493 { Buf = std::move(In); }

Here is the caller graph for this function:

virtual void StdCompiler::setRuntimeWritesAllowed ( int32_t  iChange)
inlinevirtualinherited

Definition at line 78 of file StdCompiler.h.

Referenced by StdRuntimeValueAdapt< T >::CompileFunc().

78 { }

Here is the caller graph for this function:

void StdCompiler::setWarnCallback ( WarnCBT  pnWarnCB,
void *  pData 
)
inlineinherited

Definition at line 291 of file StdCompiler.h.

291 { pWarnCB = pnWarnCB; pWarnData = pData; }
void StdCompilerBinRead::String ( char *  szString,
size_t  iMaxLength,
RawCompileType  eType = RCT_Escaped 
)
virtual

Implements StdCompiler.

Definition at line 126 of file StdCompiler.cpp.

References Buf, StdCompiler::excCorrupt(), StdCompiler::excEOF(), StdBuf::getSize(), and iPos.

127 {
128  // At least one byte data needed
129  if (iPos >= Buf.getSize())
130  { excEOF(); return; }
131  // Copy until no data left
132  char *pPos = szString;
133  while ((*pPos++ = *getBufPtr<char>(Buf, iPos++)))
134  if (iPos >= Buf.getSize())
135  { excEOF(); return; }
136  else if (pPos > szString + iMaxLength)
137  { excCorrupt("string too long"); return; }
138 }
void excCorrupt(const char *szMessage,...)
Definition: StdCompiler.h:258
void excEOF(const char *szMessage="EOF",...)
Definition: StdCompiler.h:252
size_t getSize() const
Definition: StdBuf.h:109

Here is the call graph for this function:

void StdCompilerBinRead::String ( char **  pszString,
RawCompileType  eType = RCT_Escaped 
)
virtual

Implements StdCompiler.

Definition at line 140 of file StdCompiler.cpp.

References Buf, StdCompiler::excEOF(), StdBuf::getPtr(), StdBuf::getSize(), and iPos.

141 {
142  // At least one byte data needed
143  if (iPos >= Buf.getSize())
144  { excEOF(); return; }
145  int iStart = iPos;
146  // Search string end
147  while (*getBufPtr<char>(Buf, iPos++))
148  if (iPos >= Buf.getSize())
149  { excEOF(); return; }
150  // Allocate and copy data
151  *pszString = (char *) malloc(iPos - iStart);
152  memcpy(*pszString, Buf.getPtr(iStart), iPos - iStart);
153 }
void excEOF(const char *szMessage="EOF",...)
Definition: StdCompiler.h:252
size_t getSize() const
Definition: StdBuf.h:109
const void * getPtr(size_t i) const
Definition: StdBuf.h:112

Here is the call graph for this function:

template<class T >
void StdCompiler::Value ( const T &  rStruct)
inlineinherited

Definition at line 170 of file StdCompiler.h.

Referenced by C4FolderHead::CompileFunc(), C4MeshDenumerator::CompileFunc(), C4NetpuncherID::CompileFunc(), C4UpdatePackageCore::CompileFunc(), C4GameVersion::CompileFunc(), C4SVal::CompileFunc(), C4Folder::CompileFunc(), C4ObjectPtr::CompileFunc(), C4NameList::CompileFunc(), C4Sky::CompileFunc(), StdDefaultAdapt< T, D >::CompileFunc(), C4GameLobby::C4PacketCountdown::CompileFunc(), C4Weather::CompileFunc(), C4LSector::CompileFunc(), C4NetFilenameAdapt::CompileFunc(), C4Property::CompileFunc(), C4ScenarioParameterDef::Option::CompileFunc(), C4ObjectInfoCore::CompileFunc(), C4ControlPacket::CompileFunc(), C4StrValAdapt< T >::CompileFunc(), C4GameRes::CompileFunc(), C4GameLobby::C4PacketSetScenarioParameter::CompileFunc(), C4Network2Address::CompileFunc(), C4RoundResultsPlayer::CompileFunc(), C4MaterialReaction::CompileFunc(), C4LeagueRequestHead::CompileFunc(), C4ValueProviderLinear::CompileFunc(), C4ValueArray::CompileFunc(), C4PlayerControlDef::CompileFunc(), C4ConfigGeneral::CompileFunc(), C4ValueMapData::CompileFunc(), C4Rect::CompileFunc(), StdNamingAdapt< T >::CompileFunc(), ValidatedStdCopyStrBufBase::CompileFunc(), C4RoundResult::CompileFunc(), C4ParticleDefCore::CompileFunc(), C4Shape::CompileFunc(), C4Team::CompileFunc(), C4LeagueReportDisconnectHead::CompileFunc(), C4ClientCore::CompileFunc(), C4SHead::CompileFunc(), C4ValueProviderX::CompileFunc(), C4ScenarioParameterDef::CompileFunc(), C4Scoreboard::CompileFunc(), C4GameResList::CompileFunc(), C4ConfigDeveloper::CompileFunc(), C4TargetRect::CompileFunc(), C4Action::CompileFunc(), C4Network2Reference::CompileFunc(), C4Control::CompileFunc(), C4Network2Status::CompileFunc(), C4SDefinitions::CompileFunc(), C4LeagueRequestHeadEnd::CompileFunc(), C4Command::CompileFunc(), StdNamingDefaultAdapt< T, D >::CompileFunc(), C4Network2ResCore::CompileFunc(), C4ValueProviderY::CompileFunc(), C4ScenarioParameterDefs::CompileFunc(), C4RoundResultsPlayers::CompileFunc(), C4DrawTransform::CompileFunc(), C4MusicSystem::CompileFunc(), C4PlayerInfoCore::CompileFunc(), C4RecordChunk::CompileFunc(), C4PlayerControlDefs::CompileFunc(), C4ValueProviderR::CompileFunc(), C4ConfigGraphics::CompileFunc(), C4ScenarioParameters::CompileFunc(), C4LeagueResponseHead::CompileFunc(), C4ObjectList::CompileFunc(), C4SGame::CompileFunc(), C4Client::CompileFunc(), C4ConfigSound::CompileFunc(), C4FoWBeam::CompileFunc(), C4Effect::CompileFunc(), C4ValueProviderAbsX::CompileFunc(), C4FoWLightSection::CompileFunc(), StdDecompileAdapt< T >::CompileFunc(), C4PropList::CompileFunc(), C4MaterialCore::CompileFunc(), C4LeagueResponseHeadStart::CompileFunc(), EditorWindowState::CompileFunc(), C4PlayerInfo::CompileFunc(), C4ValueProviderAbsY::CompileFunc(), C4SPlrStart::CompileFunc(), C4Def::CompileFunc(), C4GameParameters::CompileFunc(), C4DefGraphicsAdapt::CompileFunc(), C4LeagueResponseHeadUpdate::CompileFunc(), C4RoundResults::CompileFunc(), StdRuntimeValueAdapt< T >::CompileFunc(), C4ValueProviderDist::CompileFunc(), C4ConfigNetwork::CompileFunc(), C4MessageBoardQuery::CompileFunc(), C4Network2ResChunkData::CompileFunc(), C4Landscape::CompileFunc(), C4LeagueResponseHeadAuthCheck::CompileFunc(), C4ClientList::CompileFunc(), C4ValueProviderXDir::CompileFunc(), C4TeamList::CompileFunc(), C4SLandscape::CompileFunc(), C4Player::CompileFunc(), C4ConfigStartup::CompileFunc(), C4Set< T >::CompileFunc(), C4ConfigLobby::CompileFunc(), C4PlayerControlAssignment::CompileFunc(), C4SWeather::CompileFunc(), C4GameControlPacket::CompileFunc(), C4ValueProviderYDir::CompileFunc(), C4NetIO::EndpointAddress::CompileFunc(), C4GraphicsOverlay::CompileFunc(), C4PacketAddr::CompileFunc(), C4Value::CompileFunc(), C4ConfigIRC::CompileFunc(), C4Object::CompileFunc(), C4SAnimals::CompileFunc(), C4ControlPlayerControl::ControlItem::CompileFunc(), StdIntAdapt< T, int_t >::CompileFunc(), C4PropListNumbered::CompileFunc(), C4ValueProviderRDir::CompileFunc(), C4SEnvironment::CompileFunc(), C4ConfigGamepad::CompileFunc(), C4PacketLeagueRoundResults::CompileFunc(), C4PktBuf::CompileFunc(), C4ConfigControls::CompileFunc(), C4KeyCodeEx::CompileFunc(), C4PktDebugRec::CompileFunc(), StdCastAdapt< T, to_t >::CompileFunc(), C4ValueProviderAbsRDir::CompileFunc(), C4ConfigSecurity::CompileFunc(), C4Scenario::CompileFunc(), C4PacketControlReq::CompileFunc(), C4PlayerControlAssignmentSet::CompileFunc(), C4KeyEventData::CompileFunc(), C4ValueProviderCosR::CompileFunc(), StdSubMeshInstance::CompileFunc(), C4IDPacket::CompileFunc(), DisconnectData::CompileFunc(), C4ValueNumbers::CompileFunc(), C4GraphicsOverlayListAdapt::CompileFunc(), C4PacketControlPkt::CompileFunc(), C4ClientPlayerInfos::CompileFunc(), StdArrayAdapt< T, M >::CompileFunc(), C4Game::CompileFunc(), C4ValueProviderSinR::CompileFunc(), C4PacketExecSyncCtrl::CompileFunc(), C4Config::CompileFunc(), C4PacketPlayerInfoUpdRequest::CompileFunc(), C4ValueProviderCosV::CompileFunc(), C4PacketList::CompileFunc(), C4PlayerControlAssignmentSets::CompileFunc(), C4PacketPlayerInfo::CompileFunc(), C4ValueProviderSinV::CompileFunc(), C4Network2ResChunk::CompileFunc(), C4PlayerControlFile::CompileFunc(), StdArrayDefaultAdapt< T, D, M >::CompileFunc(), C4ValueProviderAction::CompileFunc(), CompileFunc(), StdBuf::CompileFunc(), C4PacketPing::CompileFunc(), StdMeshInstanceAnimationNode::CompileFunc(), C4PacketConn::CompileFunc(), C4MapFolderData::CompileFunc(), C4PlayerControl::CSync::ControlDownState::CompileFunc(), StdArrayDefaultArrayAdapt< T, D, M >::CompileFunc(), C4PacketConnRe::CompileFunc(), C4PlayerControl::CSync::CompileFunc(), C4PacketFwd::CompileFunc(), C4PacketResStatus::CompileFunc(), C4PlayerInfoList::CompileFunc(), C4PlayerControl::CompileFunc(), StdInsertAdapt< T, I >::CompileFunc(), C4PacketResDiscover::CompileFunc(), C4PacketPostMortem::CompileFunc(), C4PacketResRequest::CompileFunc(), C4PacketJoinData::CompileFunc(), C4PacketActivateReq::CompileFunc(), C4CustomKey::CompileFunc(), StdMeshInstance::SerializableValueProvider::CompileFunc(), StdMeshInstance::AttachedMesh::CompileFunc(), C4KeyboardInput::CompileFunc(), StdMeshInstance::CompileFunc(), StdSTLContainerAdapt< C >::CompileFunc(), StdIntPackAdapt< T >::CompileFunc(), StdEnumAdapt< T, int_t >::CompileFunc(), C4ObjectListDumpHelper::CompileFunc(), StdBitfieldAdapt< T >::CompileFunc(), StdNamingCountAdapt< int_t >::CompileFunc(), CompileNewFunc(), CompileNewFuncCtx(), C4ValueNumbers::CompileValue(), StdCompiler::DoCompilation(), C4Network2RefClient::GetReferences(), C4Playback::ReadBinary(), C4PropListStatic::RefCompileFunc(), StdPtrAdaptCompileFunc(), StdPtrAdaptDecompileNewFunc(), and unpack_class< T >::unpack().

170 { rStruct.CompileFunc(this); }
template<class T >
void StdCompiler::Value ( T &  rStruct)
inlineinherited

Definition at line 171 of file StdCompiler.h.

References CompileFunc().

171 { CompileFunc(rStruct, this); }
void CompileFunc(T &rStruct, StdCompiler *pComp)
Definition: StdCompiler.h:309

Here is the call graph for this function:

void StdCompiler::Value ( int32_t &  rInt)
inlineinherited

Definition at line 173 of file StdCompiler.h.

References StdCompiler::DWord().

173 { DWord(rInt); }
virtual void DWord(int32_t &rInt)=0

Here is the call graph for this function:

void StdCompiler::Value ( uint32_t &  rInt)
inlineinherited

Definition at line 174 of file StdCompiler.h.

References StdCompiler::DWord().

174 { DWord(rInt); }
virtual void DWord(int32_t &rInt)=0

Here is the call graph for this function:

void StdCompiler::Value ( int16_t &  rInt)
inlineinherited

Definition at line 175 of file StdCompiler.h.

References StdCompiler::Word().

175 { Word(rInt); }
virtual void Word(int16_t &rShort)=0

Here is the call graph for this function:

void StdCompiler::Value ( uint16_t &  rInt)
inlineinherited

Definition at line 176 of file StdCompiler.h.

References StdCompiler::Word().

176 { Word(rInt); }
virtual void Word(int16_t &rShort)=0

Here is the call graph for this function:

void StdCompiler::Value ( int8_t &  rInt)
inlineinherited

Definition at line 177 of file StdCompiler.h.

References StdCompiler::Byte().

177 { Byte(rInt); }
virtual void Byte(int8_t &rByte)=0

Here is the call graph for this function:

void StdCompiler::Value ( uint8_t &  rInt)
inlineinherited

Definition at line 178 of file StdCompiler.h.

References StdCompiler::Byte().

178 { Byte(rInt); }
virtual void Byte(int8_t &rByte)=0

Here is the call graph for this function:

void StdCompiler::Value ( bool &  rBool)
inlineinherited

Definition at line 179 of file StdCompiler.h.

References StdCompiler::Boolean().

179 { Boolean(rBool); }
virtual void Boolean(bool &rBool)=0

Here is the call graph for this function:

void StdCompiler::Warn ( const char *  szWarning,
  ... 
)
inherited

Definition at line 26 of file StdCompiler.cpp.

References StdStrBuf::FormatV(), StdStrBuf::getData(), and StdCompiler::getPosition().

Referenced by StdCompilerINIRead::Byte(), StdEnumAdapt< T, int_t >::CompileFunc(), StdBitfieldAdapt< T >::CompileFunc(), StdCompilerINIRead::CreateNameTree(), StdCompilerINIRead::NameEnd(), StdCompilerINIRead::Raw(), StdCompilerINIRead::ReadEscapedChar(), StdCompilerINIRead::ReadString(), and StdCompilerINIRead::Word().

27 {
28  // Got warning callback?
29  if (!pWarnCB) return;
30  // Format message
31  va_list args; va_start(args, szWarning);
32  StdStrBuf Msg; Msg.FormatV(szWarning, args);
33  // do callback
34  (*pWarnCB)(pWarnData, getPosition().getData(), Msg.getData());
35 }
const char * getData() const
Definition: StdBuf.h:450
virtual StdStrBuf getPosition() const
Definition: StdCompiler.h:160
void FormatV(const char *szFmt, va_list args)
Definition: StdBuf.cpp:189

Here is the call graph for this function:

Here is the caller graph for this function:

void StdCompilerBinRead::Word ( int16_t &  rShort)
virtual

Implements StdCompiler.

Definition at line 120 of file StdCompiler.cpp.

References ReadValue().

120 { ReadValue(rShort); }
void ReadValue(T &rValue)

Here is the call graph for this function:

void StdCompilerBinRead::Word ( uint16_t &  rShort)
virtual

Implements StdCompiler.

Definition at line 121 of file StdCompiler.cpp.

References ReadValue().

121 { ReadValue(rShort); }
void ReadValue(T &rValue)

Here is the call graph for this function:

Member Data Documentation

StdBuf StdCompilerBinRead::Buf
protected

Definition at line 524 of file StdCompiler.h.

Referenced by getRemainingBytes(), Raw(), ReadValue(), setInput(), and String().

size_t StdCompilerBinRead::iPos
protected

Definition at line 523 of file StdCompiler.h.

Referenced by Begin(), getPosition(), getRemainingBytes(), Raw(), ReadValue(), and String().


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