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

#include <C4Aul.h>

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

Public Member Functions

 C4AulParseError (C4ScriptHost *pScript, const char *pMsg)
 
 C4AulParseError (class C4AulParse *state, const char *pMsg)
 
 C4AulParseError (C4AulScriptFunc *Fn, const char *SPos, const char *pMsg)
 
virtual const char * what () const noexcept
 

Protected Attributes

StdCopyStrBuf sMessage
 

Detailed Description

Definition at line 54 of file C4Aul.h.

Constructor & Destructor Documentation

C4AulParseError::C4AulParseError ( C4ScriptHost pScript,
const char *  pMsg 
)

Definition at line 198 of file C4AulParse.cpp.

References StdStrBuf::AppendFormat(), StdStrBuf::Copy(), StdStrBuf::getData(), C4ScriptHost::ScriptName, and C4AulError::sMessage.

199 {
200  // compose error string
201  sMessage.Copy(pMsg);
202  if (pScript)
203  {
204  // Script name
205  sMessage.AppendFormat(" (%s)",
206  pScript->ScriptName.getData());
207  }
208 }
const char * getData() const
Definition: StdBuf.h:450
void AppendFormat(const char *szFmt,...) GNUC_FORMAT_ATTRIBUTE_O
Definition: StdBuf.cpp:197
void Copy()
Definition: StdBuf.h:475
StdCopyStrBuf ScriptName
Definition: C4ScriptHost.h:57
StdCopyStrBuf sMessage
Definition: C4Aul.h:46

Here is the call graph for this function:

C4AulParseError::C4AulParseError ( class C4AulParse state,
const char *  pMsg 
)

Definition at line 191 of file C4AulParse.cpp.

References StdStrBuf::Copy(), and C4AulError::sMessage.

192 {
193  // compose error string
194  sMessage.Copy(pMsg);
195  state->AppendPosition(sMessage);
196 }
void Copy()
Definition: StdBuf.h:475
StdCopyStrBuf sMessage
Definition: C4Aul.h:46

Here is the call graph for this function:

C4AulParseError::C4AulParseError ( C4AulScriptFunc Fn,
const char *  SPos,
const char *  pMsg 
)

Definition at line 210 of file C4AulParse.cpp.

References StdStrBuf::Append(), StdStrBuf::AppendChar(), StdStrBuf::AppendFormat(), StdStrBuf::Copy(), StdStrBuf::getData(), C4AulFunc::GetName(), C4ScriptHost::GetScript(), C4AulScriptFunc::pOrgScript, C4ScriptHost::ScriptName, SGetLine(), SLineGetCharacters(), and C4AulError::sMessage.

211 {
212  // compose error string
213  sMessage.Copy(pMsg);
214  if (!Fn) return;
215  sMessage.Append(" (");
216  // Show function name
217  if (Fn->GetName())
218  sMessage.AppendFormat("in %s", Fn->GetName());
219  if (Fn->GetName() && Fn->pOrgScript && SPos)
220  sMessage.Append(", ");
221  // Exact position
222  if (Fn->pOrgScript && SPos)
223  sMessage.AppendFormat("%s:%d:%d)",
225  SGetLine(Fn->pOrgScript->GetScript(), SPos),
226  SLineGetCharacters(Fn->pOrgScript->GetScript(), SPos));
227  else
228  sMessage.AppendChar(')');
229 }
const char * getData() const
Definition: StdBuf.h:450
int SGetLine(const char *szText, const char *cpPosition)
Definition: Standard.cpp:450
const char * GetName() const
Definition: C4AulFunc.h:57
C4ScriptHost * pOrgScript
int SLineGetCharacters(const char *szText, const char *cpPosition)
Definition: Standard.cpp:462
void AppendFormat(const char *szFmt,...) GNUC_FORMAT_ATTRIBUTE_O
Definition: StdBuf.cpp:197
void AppendChar(char cChar)
Definition: StdBuf.h:596
void Append(const char *pnData, size_t iChars)
Definition: StdBuf.h:527
const char * GetScript() const
Definition: C4ScriptHost.h:52
void Copy()
Definition: StdBuf.h:475
StdCopyStrBuf ScriptName
Definition: C4ScriptHost.h:57
StdCopyStrBuf sMessage
Definition: C4Aul.h:46

Here is the call graph for this function:

Member Function Documentation

virtual const char* C4AulError::what ( ) const
virtualnoexceptinherited

Member Data Documentation

StdCopyStrBuf C4AulError::sMessage
protectedinherited

Definition at line 46 of file C4Aul.h.

Referenced by C4AulExecError::C4AulExecError(), and C4AulParseError().


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