OpenClonk
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)
 
bool isDeserializer () override
 
void DWord (int32_t &rInt) override
 
void DWord (uint32_t &rInt) override
 
void Word (int16_t &rShort) override
 
void Word (uint16_t &rShort) override
 
void Byte (int8_t &rByte) override
 
void Byte (uint8_t &rByte) override
 
void Boolean (bool &rBool) override
 
void Character (char &rChar) override
 
void String (char *szString, size_t iMaxLength, RawCompileType eType=RCT_Escaped) override
 
void String (char **pszString, RawCompileType eType=RCT_Escaped) override
 
void String (std::string &str, RawCompileType eType=RCT_Escaped) override
 
void Raw (void *pData, size_t iSize, RawCompileType eType=RCT_Escaped) override
 
StdStrBuf getPosition () const override
 
void Begin () override
 
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)
 
static bool IsStringEnd (char c, RawCompileType eType)
 

Protected Attributes

size_t iPos
 
StdBuf Buf
 

Detailed Description

Definition at line 485 of file StdCompiler.h.

Member Typedef Documentation

◆ InT

Definition at line 490 of file StdCompiler.h.

◆ WarnCBT

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

Definition at line 281 of file StdCompiler.h.

Member Enumeration Documentation

◆ RawCompileType

Enumerator
RCT_Escaped 
RCT_All 
RCT_Idtf 
RCT_IdtfAllowEmpty 
RCT_ID 

Definition at line 135 of file StdCompiler.h.

136  {
137  RCT_Escaped=0,// Any data allowed, no separator needed (default)
138  RCT_All, // Printable characters only, must be last element in naming.
139  RCT_Idtf, // Alphanumerical characters or '_', separator needed.
140  RCT_IdtfAllowEmpty, // Like RCT_Idtf, but empty strings are also allowed
141  RCT_ID // Like RCT_Idtf (only used for special compilers that treat IDs differently)
142  };

◆ Sep

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 103 of file StdCompiler.h.

104  {
105  SEP_NONE=0, // No separator ("")
106  SEP_SEP, // Array separation (",")
107  SEP_SEP2, // Array separation 2 (";")
108  SEP_SET, // Map pair separation ("=")
109  SEP_PART, // Value part separation (".")
110  SEP_PART2, // Value part separation 2 (":")
111  SEP_PLUS, // Value separation with a '+' char ("+")
112  SEP_START, // Start some sort of list ('(')
113  SEP_END, // End some sort of list ('(')
114  SEP_START2, // Start some sort of list ('[')
115  SEP_END2, // End some sort of list (']')
116  SEP_VLINE, // Vertical line separator ('|')
117  SEP_DOLLAR // Dollar sign ('$')
118  };

Member Function Documentation

◆ Begin()

void StdCompilerBinRead::Begin ( )
overridevirtual

Reimplemented from StdCompiler.

Definition at line 211 of file StdCompiler.cpp.

Referenced by C4Playback::ReadBinary().

212 {
213  iPos = 0;
214 }
Here is the caller graph for this function:

◆ BeginSecond()

virtual void StdCompiler::BeginSecond ( )
inlinevirtualinherited

Reimplemented in StdCompilerBinWrite.

Definition at line 155 of file StdCompiler.h.

Referenced by StdCompiler::DoCompilation(), and StdCompilerBinWrite::isDoublePass().

155 { }
Here is the caller graph for this function:

◆ Boolean()

void StdCompilerBinRead::Boolean ( bool &  rBool)
overridevirtual

Implements StdCompiler.

Definition at line 137 of file StdCompiler.cpp.

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

◆ Byte() [1/2]

void StdCompilerBinRead::Byte ( int8_t &  rByte)
overridevirtual

Implements StdCompiler.

Definition at line 135 of file StdCompiler.cpp.

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

◆ Byte() [2/2]

void StdCompilerBinRead::Byte ( uint8_t &  rByte)
overridevirtual

Implements StdCompiler.

Definition at line 136 of file StdCompiler.cpp.

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

◆ Character()

void StdCompilerBinRead::Character ( char &  rChar)
overridevirtual

Implements StdCompiler.

Definition at line 138 of file StdCompiler.cpp.

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

◆ Compile()

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

Definition at line 173 of file StdCompiler.h.

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

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

174  {
175  assert(isDeserializer());
176  DoCompilation(rStruct);
177  }
void DoCompilation(T &rStruct)
Definition: StdCompiler.h:188
virtual bool isDeserializer()
Definition: StdCompiler.h:53
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Decompile()

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

Definition at line 178 of file StdCompiler.h.

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

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

179  {
180  assert(!isDeserializer());
181  DoCompilation(const_cast<T &>(rStruct));
182  }
void DoCompilation(T &rStruct)
Definition: StdCompiler.h:188
virtual bool isDeserializer()
Definition: StdCompiler.h:53
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Default()

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

Reimplemented in C4ValueCompiler.

Definition at line 88 of file StdCompiler.h.

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

88 { return true; }
Here is the caller graph for this function:

◆ DoCompilation()

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

Definition at line 188 of file StdCompiler.h.

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

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

189  {
190  // Start compilation, do first pass
191  Begin();
192  Value(rStruct);
193  // Second pass needed?
194  if (isDoublePass())
195  {
196  BeginSecond();
197  Value(rStruct);
198  }
199  // Finish
200  End();
201  }
virtual void End()
Definition: StdCompiler.h:156
virtual bool isDoublePass()
Definition: StdCompiler.h:50
void Value(const T &rStruct)
Definition: StdCompiler.h:161
virtual void Begin()
Definition: StdCompiler.h:154
virtual void BeginSecond()
Definition: StdCompiler.h:155
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DWord() [1/2]

void StdCompilerBinRead::DWord ( int32_t &  rInt)
overridevirtual

Implements StdCompiler.

Definition at line 131 of file StdCompiler.cpp.

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

◆ DWord() [2/2]

void StdCompilerBinRead::DWord ( uint32_t &  rInt)
overridevirtual

Implements StdCompiler.

Definition at line 132 of file StdCompiler.cpp.

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

◆ End()

virtual void StdCompiler::End ( )
inlinevirtualinherited

Reimplemented in StdCompilerINIRead, and StdCompilerINIWrite.

Definition at line 156 of file StdCompiler.h.

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

156 { }
Here is the caller graph for this function:

◆ excCorrupt()

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

Definition at line 249 of file StdCompiler.h.

References StdCompiler::Boolean(), StdCompiler::Byte(), CompileFunc(), StdCompiler::DWord(), FormatStringV(), StdCompiler::getPosition(), and StdCompiler::Word().

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

250  {
251  // Throw the appropriate exception
252  va_list args; va_start(args, szMessage);
253  throw new CorruptException(getPosition(), FormatStringV(szMessage, args));
254  }
StdStrBuf FormatStringV(const char *szFmt, va_list args)
Definition: StdBuf.cpp:276
virtual StdStrBuf getPosition() const
Definition: StdCompiler.h:151
Here is the call graph for this function:
Here is the caller graph for this function:

◆ excEOF()

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

Definition at line 243 of file StdCompiler.h.

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

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

244  {
245  // Throw the appropriate exception
246  va_list args; va_start(args, szMessage);
247  throw new EOFException(getPosition(), FormatStringV(szMessage, args));
248  }
StdStrBuf FormatStringV(const char *szFmt, va_list args)
Definition: StdBuf.cpp:276
virtual StdStrBuf getPosition() const
Definition: StdCompiler.h:151
Here is the call graph for this function:
Here is the caller graph for this function:

◆ excNotFound()

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

Definition at line 233 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().

234  {
235 #ifdef STDCOMPILER_EXCEPTION_WORKAROUND
236  // Exception workaround: Just set a flag in failesafe mode.
237  if (fFailSafe) { fFail = true; return; }
238 #endif
239  // Throw the appropriate exception
240  va_list args; va_start(args, szMessage);
241  throw new NotFoundException(getPosition(), FormatStringV(szMessage, args));
242  }
StdStrBuf FormatStringV(const char *szFmt, va_list args)
Definition: StdBuf.cpp:276
virtual StdStrBuf getPosition() const
Definition: StdCompiler.h:151
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FollowName()

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

Reimplemented in StdCompilerINIRead.

Definition at line 84 of file StdCompiler.h.

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

Referenced by C4Object::CompileFunc(), and StdCompilerINIRead::hasNaming().

84 { NameEnd(); return Name(szName); }
virtual bool Name(const char *szName)
Definition: StdCompiler.h:77
virtual void NameEnd(bool fBreak=false)
Definition: StdCompiler.h:78
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetNameByIndex()

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

Reimplemented in StdCompilerINIRead.

Definition at line 79 of file StdCompiler.h.

Referenced by C4ScenarioParameters::CompileFunc(), and StdCompilerINIRead::hasNaming().

79 { return nullptr; }
Here is the caller graph for this function:

◆ getPosition() [1/2]

StdStrBuf StdCompilerBinRead::getPosition ( ) const
overridevirtual

Reimplemented from StdCompiler.

Definition at line 195 of file StdCompiler.cpp.

References FormatString().

Referenced by C4Playback::ReadBinary().

196 {
197  return FormatString("byte %ld", static_cast<unsigned long>(iPos));
198 }
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:270
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPosition() [2/2]

size_t StdCompilerBinRead::getPosition ( )
inline

Definition at line 517 of file StdCompiler.h.

517 { return iPos; }

◆ getRemainingBytes()

size_t StdCompilerBinRead::getRemainingBytes ( )
inline

Definition at line 518 of file StdCompiler.h.

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

◆ hasNaming()

◆ isDeserializer()

bool StdCompilerBinRead::isDeserializer ( )
inlineoverridevirtual

Reimplemented from StdCompiler.

Definition at line 494 of file StdCompiler.h.

References StdCompiler::Begin(), StdCompiler::Boolean(), StdCompiler::Byte(), StdCompiler::Character(), StdCompiler::DWord(), StdCompiler::getPosition(), iSize, StdCompiler::Raw(), StdCompiler::RCT_Escaped, StdCompiler::String(), and StdCompiler::Word().

494 { return true; }
Here is the call graph for this function:

◆ isDoublePass()

virtual bool StdCompiler::isDoublePass ( )
inlinevirtualinherited

Reimplemented in StdCompilerBinWrite.

Definition at line 50 of file StdCompiler.h.

Referenced by StdCompiler::DoCompilation().

50 { return false; }
Here is the caller graph for this function:

◆ isRegistry()

virtual bool StdCompiler::isRegistry ( )
inlinevirtualinherited

Definition at line 65 of file StdCompiler.h.

Referenced by C4PlayerControlAssignmentSets::CompileFunc().

65 { return false; }
Here is the caller graph for this function:

◆ isSerializer()

bool StdCompiler::isSerializer ( )
inlineinherited

Definition at line 54 of file StdCompiler.h.

References StdCompiler::isDeserializer().

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

54 { return !isDeserializer(); }
virtual bool isDeserializer()
Definition: StdCompiler.h:53
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsStringEnd()

bool StdCompiler::IsStringEnd ( char  c,
RawCompileType  eType 
)
staticprotectedinherited

Definition at line 53 of file StdCompiler.cpp.

References StdCompiler::RCT_All, StdCompiler::RCT_Escaped, StdCompiler::RCT_ID, StdCompiler::RCT_Idtf, and StdCompiler::RCT_IdtfAllowEmpty.

Referenced by StdCompiler::setWarnCallback(), and StdCompilerINIRead::TestStringEnd().

54 {
55  switch (eType)
56  {
57  case RCT_Escaped: return c == '"' || !c || c == '\n' || c == '\r';
58  case RCT_All: return !c || c == '\n' || c == '\r';
59  // '-' is needed for Layers in Scenario.txt (C4NameList) and other Material-Texture combinations
60  case RCT_Idtf: case RCT_IdtfAllowEmpty: case RCT_ID: return !isalnum((unsigned char)c) && c != '_' && c != '-';
61  }
62  // unreachable
63  return true;
64 }
Here is the caller graph for this function:

◆ isVerbose()

virtual bool StdCompiler::isVerbose ( )
inlinevirtualinherited

Reimplemented in C4ValueCompiler.

Definition at line 62 of file StdCompiler.h.

References StdCompiler::hasNaming().

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

62 { return hasNaming(); }
virtual bool hasNaming()
Definition: StdCompiler.h:58
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Name()

◆ NameCount()

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

Reimplemented in StdCompilerINIRead, and StdCompilerNull.

Definition at line 91 of file StdCompiler.h.

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

91 { assert(false); return 0; }
Here is the caller graph for this function:

◆ NameEnd()

◆ NoSeparator()

virtual void StdCompiler::NoSeparator ( )
inlinevirtualinherited

Reimplemented in StdCompilerINIRead.

Definition at line 120 of file StdCompiler.h.

References StdCompiler::Boolean(), StdCompiler::Byte(), StdCompiler::Character(), StdCompiler::DWord(), and StdCompiler::Word().

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

120 { }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Raw()

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

Implements StdCompiler.

Definition at line 186 of file StdCompiler.cpp.

References StdCompiler::excEOF(), and iSize.

187 {
188  if (iPos + iSize > Buf.getSize())
189  { excEOF(); return; }
190  // Copy data
191  memcpy(pData, Buf.getPtr(iPos), iSize);
192  iPos += iSize;
193 }
const void * getPtr(size_t i) const
Definition: StdBuf.h:104
void excEOF(const char *szMessage="EOF",...)
Definition: StdCompiler.h:243
size_t getSize() const
Definition: StdBuf.h:101
int iSize
Definition: TstC4NetIO.cpp:32
Here is the call graph for this function:

◆ ReadValue()

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

Definition at line 201 of file StdCompiler.cpp.

References StdCompiler::excEOF().

202 {
203  // Pufferüberhang prüfen
204  if (iPos + sizeof(T) > Buf.getSize())
205  { excEOF(); return; }
206  // Kopieren
207  rValue = *getBufPtr<T>(Buf, iPos);
208  iPos += sizeof(T);
209 }
void excEOF(const char *szMessage="EOF",...)
Definition: StdCompiler.h:243
size_t getSize() const
Definition: StdBuf.h:101
Here is the call graph for this function:

◆ Separator()

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

Reimplemented in StdCompilerINIRead, and StdCompilerINIWrite.

Definition at line 119 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< C4String *>::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(), C4ValueProviderSinR::CompileFunc(), StdArrayAdapt< T, M >::CompileFunc(), C4ValueProviderCosV::CompileFunc(), C4ValueProviderSinV::CompileFunc(), C4ValueProviderAction::CompileFunc(), StdBuf::CompileFunc(), StdArrayDefaultAdapt< T, D, M >::CompileFunc(), C4PlayerControl::CSync::ControlDownState::CompileFunc(), StdArrayDefaultArrayAdapt< T, D, M >::CompileFunc(), StdSTLContainerAdapt< C >::CompileFunc(), StdBitfieldAdapt< T >::CompileFunc(), C4ValueNumbers::CompileValue(), C4IDList::DeleteItem(), StdCompilerINIWrite::hasNaming(), StdCompilerINIRead::hasNaming(), and C4PropListStatic::RefCompileFunc().

119 { return true; }
Here is the caller graph for this function:

◆ SeparatorToChar()

char StdCompiler::SeparatorToChar ( Sep  eSep)
staticprotectedinherited

Definition at line 32 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(), StdCompilerINIRead::Separator(), and StdCompiler::setWarnCallback().

33 {
34  switch (eSep)
35  {
36  case SEP_SEP: return ',';
37  case SEP_SEP2: return ';';
38  case SEP_SET: return '=';
39  case SEP_PART: return '.';
40  case SEP_PART2: return ':';
41  case SEP_PLUS: return '+';
42  case SEP_START: return '(';
43  case SEP_END: return ')';
44  case SEP_START2: return '[';
45  case SEP_END2: return ']';
46  case SEP_VLINE: return '|';
47  case SEP_DOLLAR: return '$';
48  default: assert(!"Unhandled Separator value");
49  }
50  return ' ';
51 }
Here is the caller graph for this function:

◆ setInput()

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

Definition at line 491 of file StdCompiler.h.

Referenced by C4Playback::ReadBinary().

491 { Buf = std::move(In); }
Here is the caller graph for this function:

◆ setRuntimeWritesAllowed()

virtual void StdCompiler::setRuntimeWritesAllowed ( int32_t  iChange)
inlinevirtualinherited

Definition at line 68 of file StdCompiler.h.

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

68 { }
Here is the caller graph for this function:

◆ setWarnCallback()

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

Definition at line 282 of file StdCompiler.h.

References StdCompiler::IsStringEnd(), StdCompiler::SeparatorToChar(), and StdCompiler::Warn().

282 { pWarnCB = pnWarnCB; pWarnData = pData; }
Here is the call graph for this function:

◆ String() [1/3]

void StdCompilerBinRead::String ( char *  szString,
size_t  iMaxLength,
RawCompileType  eType = RCT_Escaped 
)
overridevirtual

Implements StdCompiler.

Definition at line 139 of file StdCompiler.cpp.

References StdCompiler::excCorrupt(), and StdCompiler::excEOF().

140 {
141  // At least one byte data needed
142  if (iPos >= Buf.getSize())
143  { excEOF(); return; }
144  // Copy until no data left
145  char *pPos = szString;
146  while ((*pPos++ = *getBufPtr<char>(Buf, iPos++)))
147  if (iPos >= Buf.getSize())
148  { excEOF(); return; }
149  else if (pPos > szString + iMaxLength)
150  { excCorrupt("string too long"); return; }
151 }
void excCorrupt(const char *szMessage,...)
Definition: StdCompiler.h:249
void excEOF(const char *szMessage="EOF",...)
Definition: StdCompiler.h:243
size_t getSize() const
Definition: StdBuf.h:101
Here is the call graph for this function:

◆ String() [2/3]

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

Implements StdCompiler.

Definition at line 153 of file StdCompiler.cpp.

References StdCompiler::excEOF().

154 {
155  // At least one byte data needed
156  if (iPos >= Buf.getSize())
157  { excEOF(); return; }
158  int iStart = iPos;
159  // Search string end
160  while (*getBufPtr<char>(Buf, iPos++))
161  if (iPos >= Buf.getSize())
162  { excEOF(); return; }
163  // Allocate and copy data
164  *pszString = (char *) malloc(iPos - iStart);
165  memcpy(*pszString, Buf.getPtr(iStart), iPos - iStart);
166 }
const void * getPtr(size_t i) const
Definition: StdBuf.h:104
void excEOF(const char *szMessage="EOF",...)
Definition: StdCompiler.h:243
size_t getSize() const
Definition: StdBuf.h:101
Here is the call graph for this function:

◆ String() [3/3]

void StdCompilerBinRead::String ( std::string &  str,
RawCompileType  eType = RCT_Escaped 
)
overridevirtual

Implements StdCompiler.

Definition at line 168 of file StdCompiler.cpp.

References StdCompiler::excEOF().

169 {
170  // At least one byte data needed
171  if (iPos >= Buf.getSize())
172  {
173  excEOF(); return;
174  }
175  int iStart = iPos;
176  // Search string end
177  while (*getBufPtr<char>(Buf, iPos++))
178  if (iPos >= Buf.getSize())
179  {
180  excEOF(); return;
181  }
182  // Copy data
183  str.assign(getBufPtr<char>(Buf, iStart), getBufPtr<char>(Buf, iPos));
184 }
void excEOF(const char *szMessage="EOF",...)
Definition: StdCompiler.h:243
size_t getSize() const
Definition: StdBuf.h:101
Here is the call graph for this function:

◆ Value() [1/9]

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

Definition at line 161 of file StdCompiler.h.

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

161 { rStruct.CompileFunc(this); }

◆ Value() [2/9]

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

Definition at line 162 of file StdCompiler.h.

References CompileFunc().

162 { CompileFunc(rStruct, this); }
void CompileFunc(T &rStruct, StdCompiler *pComp)
Definition: StdCompiler.h:301
Here is the call graph for this function:

◆ Value() [3/9]

void StdCompiler::Value ( int32_t &  rInt)
inlineinherited

Definition at line 164 of file StdCompiler.h.

References StdCompiler::DWord().

164 { DWord(rInt); }
virtual void DWord(int32_t &rInt)=0
Here is the call graph for this function:

◆ Value() [4/9]

void StdCompiler::Value ( uint32_t &  rInt)
inlineinherited

Definition at line 165 of file StdCompiler.h.

References StdCompiler::DWord().

165 { DWord(rInt); }
virtual void DWord(int32_t &rInt)=0
Here is the call graph for this function:

◆ Value() [5/9]

void StdCompiler::Value ( int16_t &  rInt)
inlineinherited

Definition at line 166 of file StdCompiler.h.

References StdCompiler::Word().

166 { Word(rInt); }
virtual void Word(int16_t &rShort)=0
Here is the call graph for this function:

◆ Value() [6/9]

void StdCompiler::Value ( uint16_t &  rInt)
inlineinherited

Definition at line 167 of file StdCompiler.h.

References StdCompiler::Word().

167 { Word(rInt); }
virtual void Word(int16_t &rShort)=0
Here is the call graph for this function:

◆ Value() [7/9]

void StdCompiler::Value ( int8_t &  rInt)
inlineinherited

Definition at line 168 of file StdCompiler.h.

References StdCompiler::Byte().

168 { Byte(rInt); }
virtual void Byte(int8_t &rByte)=0
Here is the call graph for this function:

◆ Value() [8/9]

void StdCompiler::Value ( uint8_t &  rInt)
inlineinherited

Definition at line 169 of file StdCompiler.h.

References StdCompiler::Byte().

169 { Byte(rInt); }
virtual void Byte(int8_t &rByte)=0
Here is the call graph for this function:

◆ Value() [9/9]

void StdCompiler::Value ( bool &  rBool)
inlineinherited

Definition at line 170 of file StdCompiler.h.

References StdCompiler::Boolean().

170 { Boolean(rBool); }
virtual void Boolean(bool &rBool)=0
Here is the call graph for this function:

◆ Warn()

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

Definition at line 21 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(), StdCompiler::setWarnCallback(), and StdCompilerINIRead::Word().

22 {
23  // Got warning callback?
24  if (!pWarnCB) return;
25  // Format message
26  va_list args; va_start(args, szWarning);
27  StdStrBuf Msg; Msg.FormatV(szWarning, args);
28  // do callback
29  (*pWarnCB)(pWarnData, getPosition().getData(), Msg.getData());
30 }
const char * getData() const
Definition: StdBuf.h:442
virtual StdStrBuf getPosition() const
Definition: StdCompiler.h:151
void FormatV(const char *szFmt, va_list args)
Definition: StdBuf.cpp:182
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Word() [1/2]

void StdCompilerBinRead::Word ( int16_t &  rShort)
overridevirtual

Implements StdCompiler.

Definition at line 133 of file StdCompiler.cpp.

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

◆ Word() [2/2]

void StdCompilerBinRead::Word ( uint16_t &  rShort)
overridevirtual

Implements StdCompiler.

Definition at line 134 of file StdCompiler.cpp.

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

Member Data Documentation

◆ Buf

StdBuf StdCompilerBinRead::Buf
protected

Definition at line 523 of file StdCompiler.h.

◆ iPos

size_t StdCompilerBinRead::iPos
protected

Definition at line 522 of file StdCompiler.h.


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