dlvhex  2.5.0
SyntaxError Class Reference

Error caused by malformed input program. More...

#include <include/dlvhex2/Error.h>

Inheritance diagram for SyntaxError:
Collaboration diagram for SyntaxError:

Public Member Functions

 SyntaxError (const std::string &msg, const unsigned line=0, const std::string &file="")
 Constructor.
virtual ~SyntaxError () throw ()
 Destructor.
virtual std::string getErrorMsg () const
 Returns a formatted error message, indicating the origin of the syntax error, if available.
void setLine (unsigned line)
 Specifies the line that should be included in the error message.
void setFile (const std::string &file)
 Specifies the filename that should be specified in the error message.

Private Attributes

unsigned line
 Line number of the error.
std::string file
 File where the error occurred.

Detailed Description

Error caused by malformed input program.

Definition at line 82 of file Error.h.


Constructor & Destructor Documentation

SyntaxError::SyntaxError ( const std::string &  msg,
const unsigned  line = 0,
const std::string &  file = "" 
) [explicit]

Constructor.

Parameters:
msgError message.
lineLine number in the input where the error occurred.
fileInput file where the error occurred.

Definition at line 53 of file Error.cpp.

virtual SyntaxError::~SyntaxError ( ) throw () [inline, virtual]

Destructor.

A custom destructor definition is needed here, because we have additional members in the class, which make it necessary to redefine the destructor with throw ().

Definition at line 103 of file Error.h.


Member Function Documentation

std::string SyntaxError::getErrorMsg ( ) const [virtual]

Returns a formatted error message, indicating the origin of the syntax error, if available.

Returns:
Error message.

Reimplemented from GeneralError.

Definition at line 64 of file Error.cpp.

References file, and line.

void SyntaxError::setFile ( const std::string &  file)

Specifies the filename that should be specified in the error message.

Parameters:
fileInput file.

Definition at line 90 of file Error.cpp.

References file.

void SyntaxError::setLine ( unsigned  line)

Specifies the line that should be included in the error message.

Parameters:
lineInput line number.

Definition at line 83 of file Error.cpp.

References line.


Field Documentation

std::string SyntaxError::file [private]

File where the error occurred.

Definition at line 132 of file Error.h.

Referenced by getErrorMsg(), and setFile().

unsigned SyntaxError::line [private]

Line number of the error.

Definition at line 130 of file Error.h.

Referenced by getErrorMsg(), and setLine().


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