Safir SDK Core
Loading...
Searching...
No Matches
Safir::Dob::Typesystem::Internal::CommonExceptionBase Class Referenceabstract

Common functionality for the exception hierarchy of the DOB typesystem. More...

#include <Safir/Dob/Typesystem/Exceptions.h>

Inheritance diagram for Safir::Dob::Typesystem::Internal::CommonExceptionBase:
[legend]
Collaboration diagram for Safir::Dob::Typesystem::Internal::CommonExceptionBase:
[legend]

Public Member Functions

 CommonExceptionBase (const std::wstring &message, const std::wstring &fileName, const Dob::Typesystem::Int64 lineNumber)
 Constructor with exception information.
 
virtual ~CommonExceptionBase () throw ()
 Destroy the exception.
 
const std::wstring GetExceptionInfo () const
 Get a formatted string containing all the information in the exception.
 
const char * what () const override throw ()
 Get the GetExceptionInfo as a UTF8 encoded string.
 
virtual TypeId GetTypeId () const =0
 Get the type id of this exception.
 
Selectors for exception information.

Probably you want to use the GetExceptionInfo method instead of these methods.

See also
GetExceptionInfo
const std::wstring & GetMessage () const
 Get the message about why the exception occurred.
 
virtual const std::wstring GetName () const =0
 Get the exception name.
 
const std::wstring & GetFileName () const
 Get the name of the file where the exception occurred.
 
Dob::Typesystem::Int64 GetLineNumber () const
 Get the line number that the exception occurred on.
 

Detailed Description

Common functionality for the exception hierarchy of the DOB typesystem.

This class contains the common parts of the FundamentalException and Exception base classes.

No exceptions except FundamentalException and Exception shall ever inherit from this class. See Exception and FundamentalException for more information on how to define your exceptions.

Constructor & Destructor Documentation

◆ CommonExceptionBase()

Safir::Dob::Typesystem::Internal::CommonExceptionBase::CommonExceptionBase ( const std::wstring & message,
const std::wstring & fileName,
const Dob::Typesystem::Int64 lineNumber )

Constructor with exception information.

Creates an exception that contains information about why and where the exception occurred.

Parameters
message[in] - A message describing why the exception occurred.
fileName[in] - The name of the file where the exception occurred. Always use WFILE as the argument for this parameter.
lineNumber[in] - The line number that the exception occurred on. Always use LINE as the argument for this parameter.

◆ ~CommonExceptionBase()

virtual Safir::Dob::Typesystem::Internal::CommonExceptionBase::~CommonExceptionBase ( )
throw ( )
virtual

Destroy the exception.

Member Function Documentation

◆ GetExceptionInfo()

const std::wstring Safir::Dob::Typesystem::Internal::CommonExceptionBase::GetExceptionInfo ( ) const

Get a formatted string containing all the information in the exception.

The string will look like this (yes, there's a line break in it): "ExceptionName at some_file_name.cpp: 453 Description: Some kind of explanation of the exception".

Returns
A formatted exception information string.

◆ GetFileName()

const std::wstring & Safir::Dob::Typesystem::Internal::CommonExceptionBase::GetFileName ( ) const

Get the name of the file where the exception occurred.

Returns
The file where the exception occurred.

◆ GetLineNumber()

Dob::Typesystem::Int64 Safir::Dob::Typesystem::Internal::CommonExceptionBase::GetLineNumber ( ) const

Get the line number that the exception occurred on.

Returns
The line number where the exception occurred.

◆ GetMessage()

const std::wstring & Safir::Dob::Typesystem::Internal::CommonExceptionBase::GetMessage ( ) const

Get the message about why the exception occurred.

Returns
The exception message.

◆ GetName()

◆ GetTypeId()

virtual TypeId Safir::Dob::Typesystem::Internal::CommonExceptionBase::GetTypeId ( ) const
pure virtual

◆ what()

const char * Safir::Dob::Typesystem::Internal::CommonExceptionBase::what ( ) const
throw ( )
override

Get the GetExceptionInfo as a UTF8 encoded string.

This method is only provided to be compatible with the std::exception class.

If at all possible, use GetExceptionInfo instead since this method performs a copy and a conversion of the string. Note: This override allow catches of std::exception to still print the complete exception message.

Returns
The exception information as a UTF8 encoded string.