PCL
pcl::SourceCodeError Class Reference

Base class for exceptions thrown by source code interpreters. More...

#include <Exception.h>

+ Inheritance diagram for pcl::SourceCodeError:

Public Member Functions

 SourceCodeError ()=default
 
 SourceCodeError (const SourceCodeError &)=default
 
template<typename T1 >
 SourceCodeError (const String &message, T1 line=-1, T1 column=-1)
 
template<typename T1 >
void AddToPosition (T1 lines, T1 columns=0)
 
int ColumnNumber () const
 
int LineNumber () const
 
String Message () const override
 
template<typename T1 >
void SetPosition (T1 line, T1 column=-1)
 
void Show () const override
 
- Public Member Functions inherited from pcl::Error
 Error ()=default
 
 Error (const Error &)=default
 
 Error (const String &message)
 
String Caption () const override
 
- Public Member Functions inherited from pcl::Exception
 Exception ()=default
 
 Exception (const pcl::Exception &)=default
 
virtual ~Exception ()
 
virtual String ExceptionClass () const
 
virtual String FormatInfo () const
 

Additional Inherited Members

- Static Public Member Functions inherited from pcl::Exception
static void DisableConsoleOutput (bool disable=true)
 
static void DisableGUIOutput (bool disable=true)
 
static void EnableConsoleOutput (bool=true)
 
static void EnableGUIOutput (bool=true)
 
static bool IsConsoleOutputEnabled ()
 
static bool IsGUIOutputEnabled ()
 

Detailed Description

A SourceCodeError represents a syntax error thrown by a source code parser or interpreter, such as a scripting engine or an XML decoder.

SourceCodeError provides an error message string associated to a line number and a column number that locate the error in the source code text being processed.

Definition at line 425 of file Exception.h.

Constructor & Destructor Documentation

◆ SourceCodeError() [1/3]

pcl::SourceCodeError::SourceCodeError ( )
default

Constructs an empty SourceCodeError object: no error message and no source code location information.

◆ SourceCodeError() [2/3]

pcl::SourceCodeError::SourceCodeError ( const SourceCodeError )
default

Copy constructor.

◆ SourceCodeError() [3/3]

template<typename T1 >
pcl::SourceCodeError::SourceCodeError ( const String message,
T1  line = -1,
T1  column = -1 
)
inline

Constructs a SourceCodeError object.

Parameters
messageThe error message. HTML entities are not interpreted as ISO 8859-1 characters, and console tags are ignored, even if the exception is to be represented on a PixInsight console. HTML entities and console tags are always written literally. This limitation is necessary to ensure representativeness of source code fragments in exception messages.
lineThe line number (starting from 1) corresponding to the position of this error in the source code text, or <= 0 if no specific source code line can be associated with this error. The default value is -1, meaning that no line number is specified by default.
columnThe column number (starting from 1) corresponding to the position of this error in the source code text, or <= 0 if no specific source code column can be associated with this error. The default value is -1, meaning that no column number is specified by default.

Definition at line 463 of file Exception.h.

Member Function Documentation

◆ AddToPosition()

template<typename T1 >
void pcl::SourceCodeError::AddToPosition ( T1  lines,
T1  columns = 0 
)
inline

Adds the specified lines and columns (optional) increments to the source code coordinates for this exception.

Valid (meaningful) source code coordinates must be >= 1. When a value <= 0 results from a call to this function, the corresponding coordinate is interpreted to be unavailable for the current exception.

This member function is useful when nested sections of a source code block are being processed recursively; for example in XML decoders.

See also
SetPosition()

Definition at line 534 of file Exception.h.

◆ ColumnNumber()

int pcl::SourceCodeError::ColumnNumber ( ) const
inline

Returns the column number in the source code text being processed, corresponding to this exception.

If a valid source code column can be associated with this exception, the returned value should be >= 1. Otherwise, if no text column can be determined for this exception, -1 is returned.

See also
LineNumber()

Definition at line 495 of file Exception.h.

◆ LineNumber()

int pcl::SourceCodeError::LineNumber ( ) const
inline

Returns the line number in the source code text being processed, corresponding to this exception.

If a valid source code line can be associated with this exception, the returned value should be >= 1. Otherwise, if no text line can be determined for this exception, -1 is returned.

See also
ColumnNumber()

Definition at line 480 of file Exception.h.

◆ Message()

String pcl::SourceCodeError::Message ( ) const
overridevirtual

Returns descriptive information for this Error object. The default implementation returns the message specified upon construction. A derived class can reimplement this function to provide additional information items such as file names, object identifiers, source code positions, date and time representations, etc.

Reimplemented from pcl::Error.

◆ SetPosition()

template<typename T1 >
void pcl::SourceCodeError::SetPosition ( T1  line,
T1  column = -1 
)
inline

Sets the source code line number and column (optional) for this exception.

Valid (meaningful) source code coordinates must be >= 1. When a value < 0 is specified, the corresponding coordinate is interpreted to be unavailable for the current exception.

This member function is useful when nested sections of a source code block are being processed recursively; for example in XML decoders.

See also
AddToPosition()

Definition at line 514 of file Exception.h.

References pcl::Range().

◆ Show()

void pcl::SourceCodeError::Show ( ) const
overridevirtual

Shows a representation of the information transported by this exception.

Exception information can be shown as text on the platform console or using graphical interfaces, depending on a global setting controlled with the EnableConsoleOutput() and EnableGUIOutput() static member functions.

See also
IsConsoleOutputEnabled(), IsGUIOutputEnabled()

Reimplemented from pcl::Exception.


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