OpenClonk
StdCompilerINIRead Class Reference

#include <StdCompiler.h>

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

Classes

struct  NameNode
 

Public Types

typedef StdStrBuf 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

 StdCompilerINIRead ()
 
 ~StdCompilerINIRead () override
 
void setInput (const InT &In)
 
bool isDeserializer () override
 
bool hasNaming () override
 
bool Name (const char *szName) override
 
void NameEnd (bool fBreak=false) override
 
bool FollowName (const char *szName) override
 
const char * GetNameByIndex (size_t idx) const override
 
bool Separator (Sep eSep) override
 
void NoSeparator () override
 
int NameCount (const char *szName=nullptr) 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
 
void End () override
 
virtual bool isDoublePass ()
 
bool isSerializer ()
 
virtual bool isVerbose ()
 
virtual bool isRegistry ()
 
virtual void setRuntimeWritesAllowed (int32_t iChange)
 
virtual bool Default (const char *szName)
 
virtual void BeginSecond ()
 
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

void CreateNameTree ()
 
void FreeNameTree ()
 
void FreeNameNode (NameNode *pNode)
 
void SkipWhitespace ()
 
void SkipNum ()
 
long ReadNum ()
 
size_t GetStringLength (RawCompileType eTyped)
 
StdBuf ReadString (size_t iLength, RawCompileType eTyped, bool fAppendNull=true)
 
bool TestStringEnd (RawCompileType eType)
 
char ReadEscapedChar ()
 
unsigned long ReadUNum ()
 
void notFound (const char *szWhat)
 
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

NameNodepNameRoot {nullptr}
 
NameNodepName
 
int iDepth {0}
 
int iRealDepth {0}
 
StdStrBuf Buf
 
const char * pPos
 
const char * pReenter
 
StdCopyStrBuf NotFoundName
 

Detailed Description

Definition at line 621 of file StdCompiler.h.

Member Typedef Documentation

◆ InT

Definition at line 629 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  };
@ RCT_IdtfAllowEmpty
Definition: StdCompiler.h:140

◆ 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  };

Constructor & Destructor Documentation

◆ StdCompilerINIRead()

StdCompilerINIRead::StdCompilerINIRead ( )
default

◆ ~StdCompilerINIRead()

StdCompilerINIRead::~StdCompilerINIRead ( )
override

Definition at line 450 of file StdCompiler.cpp.

451 {
452  FreeNameTree();
453 }

References FreeNameTree().

Here is the call graph for this function:

Member Function Documentation

◆ Begin()

void StdCompilerINIRead::Begin ( )
overridevirtual

Reimplemented from StdCompiler.

Definition at line 740 of file StdCompiler.cpp.

741 {
742  // Already running? This may happen if someone confuses Compile with Value.
743  assert(!iDepth && !iRealDepth && !pNameRoot);
744  // Create tree
745  CreateNameTree();
746  // Start must be inside a section
747  iDepth = iRealDepth = 0;
748  pPos = nullptr; pReenter = nullptr;
749 }
NameNode * pNameRoot
Definition: StdCompiler.h:693
const char * pPos
Definition: StdCompiler.h:702
const char * pReenter
Definition: StdCompiler.h:705

References CreateNameTree(), iDepth, iRealDepth, pNameRoot, pPos, and pReenter.

Referenced by C4Network2RefClient::GetReferences().

Here is the call graph for this function:
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.

155 { }

Referenced by StdCompiler::DoCompilation().

Here is the caller graph for this function:

◆ Boolean()

void StdCompilerINIRead::Boolean ( bool &  rBool)
overridevirtual

Implements StdCompiler.

Definition at line 641 of file StdCompiler.cpp.

642 {
643  if (!pPos) { notFound("Boolean"); return; }
644  if (*pPos == '1' && !isdigit((unsigned char)*(pPos+1)))
645  { rBool = true; pPos ++; }
646  else if (*pPos == '0' && !isdigit((unsigned char)*(pPos+1)))
647  { rBool = false; pPos ++; }
648  else if (SEqual2(pPos, "true"))
649  { rBool = true; pPos += 4; }
650  else if (SEqual2(pPos, "false"))
651  { rBool = false; pPos += 5; }
652  else
653  { notFound("Boolean"); return; }
654 }
bool SEqual2(const char *szStr1, const char *szStr2)
Definition: Standard.cpp:204
void notFound(const char *szWhat)

References notFound(), pPos, and SEqual2().

Here is the call graph for this function:

◆ Byte() [1/2]

void StdCompilerINIRead::Byte ( int8_t &  rByte)
overridevirtual

Implements StdCompiler.

Definition at line 625 of file StdCompiler.cpp.

626 {
627  const int MIN = -(1 << 7), MAX = (1 << 7) - 1;
628  int iNum = ReadNum();
629  if (iNum < MIN || iNum > MAX)
630  Warn("number out of range (%d to %d): %d ", MIN, MAX, iNum);
631  rByte = Clamp(iNum, MIN, MAX);
632 }
T Clamp(T bval, T lbound, T rbound)
Definition: Standard.h:44
void Warn(const char *szWarning,...)
Definition: StdCompiler.cpp:21

References Clamp(), ReadNum(), and StdCompiler::Warn().

Here is the call graph for this function:

◆ Byte() [2/2]

void StdCompilerINIRead::Byte ( uint8_t &  rByte)
overridevirtual

Implements StdCompiler.

Definition at line 633 of file StdCompiler.cpp.

634 {
635  const unsigned int MIN = 0, MAX = (1 << 8) - 1;
636  unsigned int iNum = ReadUNum();
637  if (iNum > MAX)
638  Warn("number out of range (%u to %u): %u ", MIN, MAX, iNum);
639  rByte = Clamp(iNum, MIN, MAX);
640 }
unsigned long ReadUNum()

References Clamp(), ReadUNum(), and StdCompiler::Warn().

Here is the call graph for this function:

◆ Character()

void StdCompilerINIRead::Character ( char &  rChar)
overridevirtual

Implements StdCompiler.

Definition at line 655 of file StdCompiler.cpp.

656 {
657  if (!pPos || !isalpha((unsigned char)*pPos))
658  { notFound("Character"); return; }
659  rChar = *pPos++;
660 }

References notFound(), and pPos.

Here is the call graph for this function:

◆ Compile()

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

Definition at line 173 of file StdCompiler.h.

174  {
175  assert(isDeserializer());
176  DoCompilation(rStruct);
177  }
void DoCompilation(T &rStruct)
Definition: StdCompiler.h:188
virtual bool isDeserializer()
Definition: StdCompiler.h:53

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

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateNameTree()

void StdCompilerINIRead::CreateNameTree ( )
protected

Definition at line 756 of file StdCompiler.cpp.

757 {
758  FreeNameTree();
759  // Create root node
760  pName = pNameRoot = new NameNode();
761  // No input? Stop
762  if (!Buf) return;
763  // Start scanning
764  pPos = Buf.getPtr(0);
765  while (*pPos)
766  {
767  // Go over whitespace
768  int iIndent = 0;
769  while (*pPos == ' ' || *pPos == '\t')
770  { pPos++; iIndent++; }
771  // Name/Section?
772  bool fSection = *pPos == '[' && isalpha((unsigned char)*(pPos+1));
773  if (fSection || isalpha((unsigned char)*pPos))
774  {
775  // Treat values as if they had more indention
776  // (so they become children of sections on the same level)
777  if (!fSection) iIndent++; else pPos++;
778  // Go up in tree structure if there is less indention
779  while (pName->Parent && pName->Indent >= iIndent)
780  pName = pName->Parent;
781  // Copy name
782  StdStrBuf Name;
783  while (isalnum((unsigned char)*pPos) || *pPos == ' ' || *pPos == '_')
784  Name.AppendChar(*pPos++);
785  while (*pPos == ' ' || *pPos == '\t') pPos++;
786  if ( *pPos != (fSection ? ']' : '=') )
787  // Warn, ignore
788  Warn(isprint((unsigned char)*pPos) ? "Unexpected character ('%c'): %s ignored" : "Unexpected character ('0x%02x'): %s ignored", unsigned(*pPos), fSection ? "section" : "value");
789  else
790  {
791  pPos++;
792  // Create new node
793  NameNode *pPrev = pName->LastChild;
794  pName =
795  pName->LastChild =
797  new NameNode(pName);
798  pName->PrevChild = pPrev;
799  pName->Name.Take(std::move(Name));
800  pName->Pos = pPos;
801  pName->Indent = iIndent;
802  pName->Section = fSection;
803  // Values don't have children (even if the indention looks like it)
804  if (!fSection)
805  pName = pName->Parent;
806  }
807  }
808  // Skip line
809  while (*pPos && (*pPos != '\n' && *pPos != '\r'))
810  pPos++;
811  while (*pPos == '\n' || *pPos == '\r')
812  pPos++;
813  }
814  // Set pointer back
815  pName = pNameRoot;
816 }
bool Name(const char *szName) override
NameNode * pName
Definition: StdCompiler.h:693
const char * getPtr(size_t i) const
Definition: StdBuf.h:448
void Take(char *pnData)
Definition: StdBuf.h:457

References Buf, StdCompilerINIRead::NameNode::FirstChild, FreeNameTree(), StdStrBuf::getPtr(), StdCompilerINIRead::NameNode::Indent, StdCompilerINIRead::NameNode::LastChild, Name(), StdCompilerINIRead::NameNode::Name, StdCompilerINIRead::NameNode::NextChild, StdCompilerINIRead::NameNode::Parent, pName, pNameRoot, StdCompilerINIRead::NameNode::Pos, pPos, StdCompilerINIRead::NameNode::PrevChild, StdCompilerINIRead::NameNode::Section, StdStrBuf::Take(), and StdCompiler::Warn().

Referenced by Begin().

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.

179  {
180  assert(!isDeserializer());
181  DoCompilation(const_cast<T &>(rStruct));
182  }

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

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

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.

88 { return true; }

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

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.

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 BeginSecond()
Definition: StdCompiler.h:155
void Value(const T &rStruct)
Definition: StdCompiler.h:161
virtual void End()
Definition: StdCompiler.h:156
virtual bool isDoublePass()
Definition: StdCompiler.h:50
virtual void Begin()
Definition: StdCompiler.h:154

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

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DWord() [1/2]

void StdCompilerINIRead::DWord ( int32_t &  rInt)
overridevirtual

Implements StdCompiler.

Definition at line 601 of file StdCompiler.cpp.

602 {
603  rInt = ReadNum();
604 }

References ReadNum().

Here is the call graph for this function:

◆ DWord() [2/2]

void StdCompilerINIRead::DWord ( uint32_t &  rInt)
overridevirtual

Implements StdCompiler.

Definition at line 605 of file StdCompiler.cpp.

606 {
607  rInt = ReadUNum();
608 }

References ReadUNum().

Here is the call graph for this function:

◆ End()

void StdCompilerINIRead::End ( )
overridevirtual

Reimplemented from StdCompiler.

Definition at line 750 of file StdCompiler.cpp.

751 {
752  assert(!iDepth && !iRealDepth);
753  FreeNameTree();
754 }

References FreeNameTree(), iDepth, and iRealDepth.

Referenced by C4Network2RefClient::GetReferences().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ excCorrupt()

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

Definition at line 249 of file StdCompiler.h.

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

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

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

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.

244  {
245  // Throw the appropriate exception
246  va_list args; va_start(args, szMessage);
247  throw new EOFException(getPosition(), FormatStringV(szMessage, args));
248  }

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

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

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.

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  }

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

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FollowName()

bool StdCompilerINIRead::FollowName ( const char *  szName)
overridevirtual

Reimplemented from StdCompiler.

Definition at line 518 of file StdCompiler.cpp.

519 {
520  // Current naming virtual?
521  if (iDepth > iRealDepth)
522  return false;
523  // Next section must be the one
524  if (!pName->NextChild || pName->NextChild->Name != szName)
525  {
526  // End current naming
527  NameEnd();
528  // Go into virtual naming
529  iDepth++;
530  return false;
531  }
532  // End current naming
533  NameEnd();
534  // Start new one
535  Name(szName);
536  // Done
537  return true;
538 }
void NameEnd(bool fBreak=false) override

References iDepth, iRealDepth, Name(), StdCompilerINIRead::NameNode::Name, NameEnd(), StdCompilerINIRead::NameNode::NextChild, and pName.

Here is the call graph for this function:

◆ FreeNameNode()

void StdCompilerINIRead::FreeNameNode ( NameNode pNode)
protected

Definition at line 825 of file StdCompiler.cpp.

826 {
827  NameNode *pNode = pDelNode;
828  while (pNode)
829  {
830  if (pNode->FirstChild)
831  pNode = pNode->FirstChild;
832  else
833  {
834  NameNode *pDelete = pNode;
835  if (pDelete == pDelNode) { delete pDelete; break; }
836  if (pNode->NextChild)
837  pNode = pNode->NextChild;
838  else
839  {
840  pNode = pNode->Parent;
841  if (pNode) pNode->FirstChild = nullptr;
842  }
843  delete pDelete;
844  }
845  }
846 }

References StdCompilerINIRead::NameNode::FirstChild, StdCompilerINIRead::NameNode::NextChild, and StdCompilerINIRead::NameNode::Parent.

Referenced by FreeNameTree().

Here is the caller graph for this function:

◆ FreeNameTree()

void StdCompilerINIRead::FreeNameTree ( )
protected

Definition at line 818 of file StdCompiler.cpp.

819 {
820  // free all nodes
822  pName = pNameRoot = nullptr;
823 }
void FreeNameNode(NameNode *pNode)

References FreeNameNode(), pName, and pNameRoot.

Referenced by CreateNameTree(), End(), and ~StdCompilerINIRead().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetNameByIndex()

const char * StdCompilerINIRead::GetNameByIndex ( size_t  idx) const
overridevirtual

Reimplemented from StdCompiler.

Definition at line 585 of file StdCompiler.cpp.

586 {
587  // not in virtual naming
588  if (iDepth > iRealDepth || !pName) return nullptr;
589  // count within current name
590  NameNode *pNode;
591  for (pNode = pName->FirstChild; pNode; pNode = pNode->NextChild)
592  // all valid subsections are counted
593  if (pNode->Pos)
594  if (!idx--)
595  return pNode->Name.getData();
596  // index out of range
597  return nullptr;
598 }

References StdCompilerINIRead::NameNode::FirstChild, StdStrBuf::getData(), iDepth, iRealDepth, StdCompilerINIRead::NameNode::Name, StdCompilerINIRead::NameNode::NextChild, pName, and StdCompilerINIRead::NameNode::Pos.

Here is the call graph for this function:

◆ getPosition()

StdStrBuf StdCompilerINIRead::getPosition ( ) const
overridevirtual

Reimplemented from StdCompiler.

Definition at line 728 of file StdCompiler.cpp.

729 {
730  if (pPos)
731  return FormatString("line %d", getLineNumberOfPos(pPos));
732  else if (iDepth == iRealDepth)
733  return FormatString(pName->Section ? R"(section "%s", after line %d)" : R"(value "%s", line %d)", pName->Name.getData(), getLineNumberOfPos(pName->Pos));
734  else if (iRealDepth)
735  return FormatString(R"(missing value/section "%s" inside section "%s" (line %d))", NotFoundName.getData(), pName->Name.getData(), getLineNumberOfPos(pName->Pos));
736  else
737  return FormatString(R"(missing value/section "%s")", NotFoundName.getData());
738 }
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:270
StdCopyStrBuf NotFoundName
Definition: StdCompiler.h:708
const char * getData() const
Definition: StdBuf.h:442

References FormatString(), StdStrBuf::getData(), iDepth, iRealDepth, StdCompilerINIRead::NameNode::Name, NotFoundName, pName, StdCompilerINIRead::NameNode::Pos, pPos, and StdCompilerINIRead::NameNode::Section.

Here is the call graph for this function:

◆ GetStringLength()

size_t StdCompilerINIRead::GetStringLength ( RawCompileType  eTyped)
protected

Definition at line 894 of file StdCompiler.cpp.

895 {
896  // Excpect valid position
897  if (!pPos)
898  { notFound("String"); return 0; }
899  // Skip whitespace
900  SkipWhitespace();
901  // Save position
902  const char *pStart = pPos;
903  // Escaped? Go over '"'
904  if (eRawType == RCT_Escaped && *pPos++ != '"')
905  { notFound("Escaped string"); return 0; }
906  // Search end of string
907  size_t iLength = 0;
908  while (!TestStringEnd(eRawType))
909  {
910  // Read a character (we're just counting atm)
911  if (eRawType == RCT_Escaped)
912  ReadEscapedChar();
913  else
914  pPos++;
915  // Count it
916  iLength++;
917  }
918  // Reset position, return the length
919  pPos = pStart;
920  return iLength;
921 }
bool TestStringEnd(RawCompileType eType)
Definition: StdCompiler.h:723

References notFound(), pPos, StdCompiler::RCT_Escaped, ReadEscapedChar(), SkipWhitespace(), and TestStringEnd().

Referenced by String().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasNaming()

bool StdCompilerINIRead::hasNaming ( )
inlineoverridevirtual

Reimplemented from StdCompiler.

Definition at line 634 of file StdCompiler.h.

634 { return true; }

◆ isDeserializer()

bool StdCompilerINIRead::isDeserializer ( )
inlineoverridevirtual

Reimplemented from StdCompiler.

Definition at line 633 of file StdCompiler.h.

633 { return true; }

◆ isDoublePass()

virtual bool StdCompiler::isDoublePass ( )
inlinevirtualinherited

Reimplemented in StdCompilerBinWrite.

Definition at line 50 of file StdCompiler.h.

50 { return false; }

Referenced by StdCompiler::DoCompilation().

Here is the caller graph for this function:

◆ isRegistry()

virtual bool StdCompiler::isRegistry ( )
inlinevirtualinherited

Definition at line 65 of file StdCompiler.h.

65 { return false; }

Referenced by C4PlayerControlAssignmentSets::CompileFunc().

Here is the caller graph for this function:

◆ isSerializer()

bool StdCompiler::isSerializer ( )
inlineinherited

Definition at line 54 of file StdCompiler.h.

54 { return !isDeserializer(); }

References StdCompiler::isDeserializer().

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

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.

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 }

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

Referenced by TestStringEnd().

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.

62 { return hasNaming(); }
virtual bool hasNaming()
Definition: StdCompiler.h:58

References StdCompiler::hasNaming().

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Name()

bool StdCompilerINIRead::Name ( const char *  szName)
overridevirtual

Reimplemented from StdCompiler.

Definition at line 456 of file StdCompiler.cpp.

457 {
458  // Increase depth
459  iDepth++;
460  // Parent category virtual?
461  if (iDepth - 1 > iRealDepth)
462  return false;
463  // Name must be alphanumerical and non-empty (force it)
464  if (!isalpha((unsigned char)*szName))
465  { assert(false); return false; }
466  for (const char *p = szName + 1; *p; p++)
467  // C4Update needs Name**...
468  if (!isalnum((unsigned char)*p) && *p != ' ' && *p != '_' && *p != '*')
469  { assert(false); return false; }
470  // Search name
471  NameNode *pNode;
472  for (pNode = pName->FirstChild; pNode; pNode = pNode->NextChild)
473  if (pNode->Pos && pNode->Name == szName)
474  break;
475  // Not found?
476  if (!pNode)
477  {
478  NotFoundName = szName;
479  return false;
480  }
481  // Save tree position, indicate success
482  pName = pNode;
483  pPos = pName->Pos;
484  pReenter = nullptr;
485  iRealDepth++;
486  return true;
487 }

References StdCompilerINIRead::NameNode::FirstChild, iDepth, iRealDepth, StdCompilerINIRead::NameNode::Name, StdCompilerINIRead::NameNode::NextChild, NotFoundName, pName, StdCompilerINIRead::NameNode::Pos, pPos, and pReenter.

Referenced by CreateNameTree(), FollowName(), and Separator().

Here is the caller graph for this function:

◆ NameCount()

int StdCompilerINIRead::NameCount ( const char *  szName = nullptr)
overridevirtual

Reimplemented from StdCompiler.

Definition at line 571 of file StdCompiler.cpp.

572 {
573  // not in virtual naming
574  if (iDepth > iRealDepth || !pName) return 0;
575  // count within current name
576  int iCount = 0;
577  NameNode *pNode;
578  for (pNode = pName->FirstChild; pNode; pNode = pNode->NextChild)
579  // if no name is given, all valid subsections are counted
580  if (pNode->Pos && (!szName || pNode->Name == szName))
581  ++iCount;
582  return iCount;
583 }

References StdCompilerINIRead::NameNode::FirstChild, iDepth, iRealDepth, StdCompilerINIRead::NameNode::Name, StdCompilerINIRead::NameNode::NextChild, pName, and StdCompilerINIRead::NameNode::Pos.

◆ NameEnd()

void StdCompilerINIRead::NameEnd ( bool  fBreak = false)
overridevirtual

Reimplemented from StdCompiler.

Definition at line 488 of file StdCompiler.cpp.

489 {
490  assert(iDepth > 0);
491  if (iRealDepth == iDepth)
492  {
493  // Remove childs
494  for (NameNode *pNode = pName->FirstChild, *pNext; pNode; pNode = pNext)
495  {
496  // Report unused entries
497  if (pNode->Pos && !fBreak)
498  Warn(R"(Unexpected %s "%s"!)", pNode->Section ? "section" : "value", pNode->Name.getData());
499  // delete node
500  pNext = pNode->NextChild;
501  delete pNode;
502  }
503  // Remove name so it won't be found again
504  NameNode *pParent = pName->Parent;
507  delete pName;
508  // Go up
509  pName = pParent;
510  iRealDepth--;
511  }
512  // Decrease depth
513  iDepth--;
514  // This is the middle of nowhere
515  pPos = nullptr; pReenter = nullptr;
516 }

References StdCompilerINIRead::NameNode::FirstChild, iDepth, iRealDepth, StdCompilerINIRead::NameNode::LastChild, StdCompilerINIRead::NameNode::NextChild, StdCompilerINIRead::NameNode::Parent, pName, pPos, pReenter, StdCompilerINIRead::NameNode::PrevChild, and StdCompiler::Warn().

Referenced by FollowName(), and Separator().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NoSeparator()

void StdCompilerINIRead::NoSeparator ( )
overridevirtual

Reimplemented from StdCompiler.

Definition at line 565 of file StdCompiler.cpp.

566 {
567  // Position saved back from separator mismatch?
568  if (pReenter) { pPos = pReenter; pReenter = nullptr; }
569 }

References pPos, and pReenter.

◆ notFound()

void StdCompilerINIRead::notFound ( const char *  szWhat)
protected

Definition at line 1031 of file StdCompiler.cpp.

1032 {
1033  excNotFound("%s expected", szWhat);
1034 }
void excNotFound(const char *szMessage,...)
Definition: StdCompiler.h:233

References StdCompiler::excNotFound().

Referenced by Boolean(), Character(), GetStringLength(), ReadNum(), ReadString(), and ReadUNum().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Raw()

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

Implements StdCompiler.

Definition at line 685 of file StdCompiler.cpp.

686 {
687  // Read data
688  StdBuf Buf = ReadString(iSize, eType, false);
689  // Correct size?
690  if (Buf.getSize() != iSize)
691  Warn("got %u bytes raw data, but %u bytes expected!", Buf.getSize(), iSize);
692  // Copy
693  MemCopy(Buf.getData(), pData, iSize);
694 }
void MemCopy(const void *lpMem1, void *lpMem2, size_t dwSize)
Definition: Standard.h:65
int iSize
Definition: TstC4NetIO.cpp:32
Definition: StdBuf.h:30
StdBuf ReadString(size_t iLength, RawCompileType eTyped, bool fAppendNull=true)
size_t getSize() const
Definition: StdBuf.h:444

References Buf, StdStrBuf::getData(), StdStrBuf::getSize(), iSize, MemCopy(), ReadString(), and StdCompiler::Warn().

Here is the call graph for this function:

◆ ReadEscapedChar()

char StdCompilerINIRead::ReadEscapedChar ( )
protected

Definition at line 974 of file StdCompiler.cpp.

975 {
976  // Catch some no-noes like \0, \n etc.
977  if (*pPos >= 0 && iscntrl((unsigned char)*pPos))
978  {
979  Warn("Nonprintable character found in string: %02x", static_cast<unsigned char>(*pPos));
980  return *pPos;
981  }
982  // Not escaped? Just return it
983  if (*pPos != '\\') return *pPos++;
984  // What type of escape?
985  switch (*++pPos)
986  {
987  case 'a': pPos++; return '\a';
988  case 'b': pPos++; return '\b';
989  case 'f': pPos++; return '\f';
990  case 'n': pPos++; return '\n';
991  case 'r': pPos++; return '\r';
992  case 't': pPos++; return '\t';
993  case 'v': pPos++; return '\v';
994  case '\'': pPos++; return '\'';
995  case '"': pPos++; return '"';
996  case '\\': pPos++; return '\\';
997  case '?': pPos++; return '?';
998  case 'x':
999  // Treat '\x' as 'x' - damn special cases
1000  if (!isxdigit((unsigned char)*++pPos))
1001  return 'x';
1002  else
1003  {
1004  // Read everything that looks like it might be hexadecimal - MSVC does it this way, so do not sue me.
1005  int iCode = 0;
1006  do
1007  { iCode = iCode * 16 + (isdigit((unsigned char)*pPos) ? *pPos - '0' : *pPos - 'a' + 10); pPos++; }
1008  while (isxdigit((unsigned char)*pPos));
1009  // Done. Don't bother to check the range (we aren't doing anything mission-critical here, are we?)
1010  return char(iCode);
1011  }
1012  default:
1013  // Not octal? Let it pass through.
1014  if (!isdigit((unsigned char)*pPos) || *pPos >= '8')
1015  return *pPos++;
1016  else
1017  {
1018  // Read it the octal way.
1019  int iCode = 0;
1020  do
1021  { iCode = iCode * 8 + (*pPos - '0'); pPos++;}
1022  while (isdigit((unsigned char)*pPos) && *pPos < '8');
1023  // Done. See above.
1024  return char(iCode);
1025  }
1026  }
1027  // unreachable
1028  assert (false);
1029 }

References pPos, and StdCompiler::Warn().

Referenced by GetStringLength(), and ReadString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadNum()

long StdCompilerINIRead::ReadNum ( )
protected

Definition at line 860 of file StdCompiler.cpp.

861 {
862  if (!pPos)
863  { notFound("Number"); return 0; }
864  // Skip whitespace
865  SkipWhitespace();
866  // Read number. If this breaks, Günther is to blame!
867  const char *pnPos = pPos;
868  long iNum = strtol(pPos, const_cast<char **>(&pnPos), 10);
869  // Could not read?
870  if (!iNum && pnPos == pPos)
871  { notFound("Number"); return 0; }
872  // Get over it
873  pPos = pnPos;
874  return iNum;
875 }

References notFound(), pPos, and SkipWhitespace().

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadString()

StdBuf StdCompilerINIRead::ReadString ( size_t  iLength,
RawCompileType  eTyped,
bool  fAppendNull = true 
)
protected

Definition at line 923 of file StdCompiler.cpp.

924 {
925  // Excpect valid position
926  if (!pPos)
927  { notFound("String"); return StdBuf(); }
928  // Skip whitespace
929  SkipWhitespace();
930  // Escaped? Go over '"'
931  if (eRawType == RCT_Escaped && *pPos++ != '"')
932  { notFound("Escaped string"); return StdBuf(); }
933  // Create buffer
934  StdBuf OutBuf; OutBuf.New(iLength + (fAppendNull ? sizeof('\0') : 0));
935  // Read
936  char *pOut = getMBufPtr<char>(OutBuf);
937  while (iLength && !TestStringEnd(eRawType))
938  {
939  // Read a character
940  if (eRawType == RCT_Escaped)
941  *pOut++ = ReadEscapedChar();
942  else
943  *pOut++ = *pPos++;
944  // Count it
945  iLength--;
946  }
947  // Escaped: Go over '"'
948  if (eRawType == RCT_Escaped)
949  {
950  while (*pPos != '"')
951  {
952  if (!*pPos || *pPos == '\n' || *pPos == '\r')
953  {
954  Warn("string not terminated!");
955  pPos--;
956  break;
957  }
958  pPos++;
959  }
960  pPos++;
961  }
962  // Nothing read? Identifiers need to be non-empty
963  if (pOut == OutBuf.getData() && (eRawType == RCT_Idtf || eRawType == RCT_ID))
964  { notFound("String"); return StdBuf(); }
965  // Append null
966  if (fAppendNull)
967  *pOut = '\0';
968  // Shrink, if less characters were read
969  OutBuf.Shrink(iLength);
970  // Done
971  return OutBuf;
972 }
void New(size_t inSize)
Definition: StdBuf.h:146
void Shrink(size_t iShrink)
Definition: StdBuf.h:180
const void * getData() const
Definition: StdBuf.h:99

References StdBuf::getData(), StdBuf::New(), notFound(), pPos, StdCompiler::RCT_Escaped, StdCompiler::RCT_ID, StdCompiler::RCT_Idtf, ReadEscapedChar(), StdBuf::Shrink(), SkipWhitespace(), TestStringEnd(), and StdCompiler::Warn().

Referenced by Raw(), and String().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadUNum()

unsigned long StdCompilerINIRead::ReadUNum ( )
protected

Definition at line 877 of file StdCompiler.cpp.

878 {
879  if (!pPos)
880  { notFound("Number"); return 0; }
881  // Skip whitespace
882  SkipWhitespace();
883  // Read number. If this breaks, Günther is to blame!
884  const char *pnPos = pPos;
885  unsigned long iNum = strtoul(pPos, const_cast<char **>(&pnPos), 10);
886  // Could not read?
887  if (!iNum && pnPos == pPos)
888  { notFound("Number"); return 0; }
889  // Get over it
890  pPos = pnPos;
891  return iNum;
892 }

References notFound(), pPos, and SkipWhitespace().

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Separator()

bool StdCompilerINIRead::Separator ( Sep  eSep)
overridevirtual

Reimplemented from StdCompiler.

Definition at line 541 of file StdCompiler.cpp.

542 {
543  if (iDepth > iRealDepth) return false;
544  // In section?
545  if (pName->Section)
546  {
547  // Store current name, search another section with the same name
548  StdStrBuf CurrName = pName->Name;
549  NameEnd();
550  return Name(CurrName.getData());
551  }
552  // Position saved back from separator mismatch?
553  if (pReenter) { pPos = pReenter; pReenter = nullptr; }
554  // Nothing to read?
555  if (!pPos) return false;
556  // Read (while skipping over whitespace)
557  SkipWhitespace();
558  // Separator mismatch? Let all read attempts fail until the correct separator is found or the naming ends.
559  if (*pPos != SeparatorToChar(eSep)) { pReenter = pPos; pPos = nullptr; return false; }
560  // Go over separator, success
561  pPos++;
562  return true;
563 }
static char SeparatorToChar(Sep eSep)
Definition: StdCompiler.cpp:32

References StdStrBuf::getData(), iDepth, iRealDepth, Name(), StdCompilerINIRead::NameNode::Name, NameEnd(), pName, pPos, pReenter, StdCompilerINIRead::NameNode::Section, StdCompiler::SeparatorToChar(), and SkipWhitespace().

Here is the call graph for this function:

◆ SeparatorToChar()

char StdCompiler::SeparatorToChar ( Sep  eSep)
staticprotectedinherited

Definition at line 32 of file StdCompiler.cpp.

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 }

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

Here is the caller graph for this function:

◆ setInput()

void StdCompilerINIRead::setInput ( const InT In)
inline

Definition at line 630 of file StdCompiler.h.

630 { Buf.Ref(In); lineBreaks.clear(); }
void Ref(const char *pnData)
Definition: StdBuf.h:455

References Buf, and StdStrBuf::Ref().

Referenced by C4Network2RefClient::GetReferences(), and C4Config::Load().

Here is the call graph for this function:
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.

68 { }

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

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.

282 { pWarnCB = pnWarnCB; pWarnData = pData; }

◆ SkipNum()

void StdCompilerINIRead::SkipNum ( )
protected

Definition at line 854 of file StdCompiler.cpp.

855 {
856  while (*pPos == '+' || *pPos == '-' || isdigit((unsigned char)*pPos))
857  pPos++;
858 }

References pPos.

◆ SkipWhitespace()

void StdCompilerINIRead::SkipWhitespace ( )
protected

Definition at line 848 of file StdCompiler.cpp.

849 {
850  while (*pPos == ' ' || *pPos == '\t')
851  pPos++;
852 }

References pPos.

Referenced by GetStringLength(), ReadNum(), ReadString(), ReadUNum(), and Separator().

Here is the caller graph for this function:

◆ String() [1/3]

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

Implements StdCompiler.

Definition at line 668 of file StdCompiler.cpp.

669 {
670  // Get length
671  size_t iLength = GetStringLength(eType);
672  // Read data
673  StdBuf Buf = ReadString(iLength, eType, true);
674  // Set
675  *pszString = reinterpret_cast<char *>(Buf.GrabPointer());
676 }
size_t GetStringLength(RawCompileType eTyped)
char * GrabPointer()
Definition: StdBuf.h:459

References Buf, GetStringLength(), StdStrBuf::GrabPointer(), and ReadString().

Here is the call graph for this function:

◆ String() [2/3]

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

Implements StdCompiler.

Definition at line 661 of file StdCompiler.cpp.

662 {
663  // Read data
664  StdBuf Buf = ReadString(iMaxLength, eType, true);
665  // Copy
666  SCopy(getBufPtr<char>(Buf), szString, iMaxLength);
667 }
void SCopy(const char *szSource, char *sTarget, size_t iMaxL)
Definition: Standard.cpp:152

References Buf, ReadString(), and SCopy().

Here is the call graph for this function:

◆ String() [3/3]

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

Implements StdCompiler.

Definition at line 677 of file StdCompiler.cpp.

678 {
679  // Get length
680  size_t iLength = GetStringLength(type);
681  // Read data
682  StdBuf Buf = ReadString(iLength, type, true);
683  str = getBufPtr<char>(Buf);
684 }

References Buf, GetStringLength(), and ReadString().

Here is the call graph for this function:

◆ TestStringEnd()

bool StdCompilerINIRead::TestStringEnd ( RawCompileType  eType)
inlineprotected

Definition at line 723 of file StdCompiler.h.

723 { return IsStringEnd(*pPos, eType); }
static bool IsStringEnd(char c, RawCompileType eType)
Definition: StdCompiler.cpp:53

References StdCompiler::IsStringEnd(), and pPos.

Referenced by GetStringLength(), and ReadString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Value() [1/9]

void StdCompiler::Value ( bool &  rBool)
inlineinherited

Definition at line 170 of file StdCompiler.h.

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

References StdCompiler::Boolean().

Here is the call graph for this function:

◆ Value() [2/9]

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

Definition at line 161 of file StdCompiler.h.

161 { rStruct.CompileFunc(this); }

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

◆ Value() [3/9]

void StdCompiler::Value ( int16_t &  rInt)
inlineinherited

Definition at line 166 of file StdCompiler.h.

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

References StdCompiler::Word().

Here is the call graph for this function:

◆ Value() [4/9]

void StdCompiler::Value ( int32_t &  rInt)
inlineinherited

Definition at line 164 of file StdCompiler.h.

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

References StdCompiler::DWord().

Here is the call graph for this function:

◆ Value() [5/9]

void StdCompiler::Value ( int8_t &  rInt)
inlineinherited

Definition at line 168 of file StdCompiler.h.

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

References StdCompiler::Byte().

Here is the call graph for this function:

◆ Value() [6/9]

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

Definition at line 162 of file StdCompiler.h.

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

References CompileFunc().

Here is the call graph for this function:

◆ Value() [7/9]

void StdCompiler::Value ( uint16_t &  rInt)
inlineinherited

Definition at line 167 of file StdCompiler.h.

167 { Word(rInt); }

References StdCompiler::Word().

Here is the call graph for this function:

◆ Value() [8/9]

void StdCompiler::Value ( uint32_t &  rInt)
inlineinherited

Definition at line 165 of file StdCompiler.h.

165 { DWord(rInt); }

References StdCompiler::DWord().

Here is the call graph for this function:

◆ Value() [9/9]

void StdCompiler::Value ( uint8_t &  rInt)
inlineinherited

Definition at line 169 of file StdCompiler.h.

169 { Byte(rInt); }

References StdCompiler::Byte().

Here is the call graph for this function:

◆ Warn()

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

Definition at line 21 of file StdCompiler.cpp.

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 }
void FormatV(const char *szFmt, va_list args)
Definition: StdBuf.cpp:182

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

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Word() [1/2]

void StdCompilerINIRead::Word ( int16_t &  rShort)
overridevirtual

Implements StdCompiler.

Definition at line 609 of file StdCompiler.cpp.

610 {
611  const int MIN = -(1 << 15), MAX = (1 << 15) - 1;
612  int iNum = ReadNum();
613  if (iNum < MIN || iNum > MAX)
614  Warn("number out of range (%d to %d): %d ", MIN, MAX, iNum);
615  rShort = Clamp(iNum, MIN, MAX);
616 }

References Clamp(), ReadNum(), and StdCompiler::Warn().

Here is the call graph for this function:

◆ Word() [2/2]

void StdCompilerINIRead::Word ( uint16_t &  rShort)
overridevirtual

Implements StdCompiler.

Definition at line 617 of file StdCompiler.cpp.

618 {
619  const unsigned int MIN = 0, MAX = (1 << 16) - 1;
620  unsigned int iNum = ReadUNum();
621  if (iNum > MAX)
622  Warn("number out of range (%u to %u): %u ", MIN, MAX, iNum);
623  rShort = Clamp(iNum, MIN, MAX);
624 }

References Clamp(), ReadUNum(), and StdCompiler::Warn().

Here is the call graph for this function:

Member Data Documentation

◆ Buf

StdStrBuf StdCompilerINIRead::Buf
protected

Definition at line 700 of file StdCompiler.h.

Referenced by CreateNameTree(), Raw(), setInput(), and String().

◆ iDepth

int StdCompilerINIRead::iDepth {0}
protected

◆ iRealDepth

int StdCompilerINIRead::iRealDepth {0}
protected

◆ NotFoundName

StdCopyStrBuf StdCompilerINIRead::NotFoundName
protected

Definition at line 708 of file StdCompiler.h.

Referenced by getPosition(), and Name().

◆ pName

NameNode * StdCompilerINIRead::pName
protected

◆ pNameRoot

NameNode* StdCompilerINIRead::pNameRoot {nullptr}
protected

Definition at line 693 of file StdCompiler.h.

Referenced by Begin(), CreateNameTree(), and FreeNameTree().

◆ pPos

◆ pReenter

const char* StdCompilerINIRead::pReenter
protected

Definition at line 705 of file StdCompiler.h.

Referenced by Begin(), Name(), NameEnd(), NoSeparator(), and Separator().


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