QtlMovie 1.12 (A specialized FFmpeg front-end)
QtlErrorBase Class Reference

Base class for objet reporting errors. More...

Inheritance diagram for QtlErrorBase:

Public Member Functions

virtual ~QtlErrorBase ()
 Virtual destructor. More...
 
bool autoReport () const
 Check if errors are automatically reported and displayed to the user. More...
 
QString errorMessage () const
 Get the last error message. More...
 
QtlLoggerlog () const
 Get the error logger. More...
 
void setAutoReport (bool autoReport)
 Set if errors are automatically reported and displayed to the user. More...
 
bool success () const
 Check if the last operation was successful. More...
 
bool valid () const
 Check if the object is valid for use. More...
 

Protected Types

enum  ErrorType {
  QTL_ERROR,
  QTL_INVALIDATE,
  QTL_FATAL
}
 Type of error to report. More...
 

Protected Member Functions

 QtlErrorBase (QObject *parent, QtlLogger *log, bool autoReport)
 Protected constructor for subclasses. More...
 
 QtlErrorBase (const QtlErrorBase &other)
 Copy constructor. More...
 
void invalidate ()
 Invalidate this object without reporting a message. More...
 
const QtlErrorBaseoperator= (const QtlErrorBase &other)
 Assignment operator. More...
 
void reportError (const QString &message=QString(), bool fatal=false) const
 Report an error message. More...
 
void setError (const QString &message, ErrorType type=QTL_ERROR) const
 Set an error message. More...
 
void setSuccess () const
 Report success of the last operation. More...
 

Private Attributes

bool _autoReport
 Automatically report errors. More...
 
QString _errorMessage
 Error message. More...
 
QtlLogger_log
 Where to log errors, never null. More...
 
bool _success
 True if last operation was successful. More...
 
bool _valid
 True if the object is valid for use. More...
 

Static Private Attributes

static QtlNullLogger _nullLog
 A void error logger. More...
 

Detailed Description

Base class for objet reporting errors.

Member Enumeration Documentation

◆ ErrorType

enum QtlErrorBase::ErrorType
protected

Type of error to report.

Enumerator
QTL_ERROR 

Error of last operation.

QTL_INVALIDATE 

Invalidate this instance.

QTL_FATAL 

Fatal error, abort application.

Constructor & Destructor Documentation

◆ ~QtlErrorBase()

virtual QtlErrorBase::~QtlErrorBase ( )
inlinevirtual

Virtual destructor.

◆ QtlErrorBase() [1/2]

QtlErrorBase::QtlErrorBase ( QObject *  parent,
QtlLogger log,
bool  autoReport 
)
protected

Protected constructor for subclasses.

The object is initially invalid, the subclass constructor shall validate it if necessary.

Parameters
[in]parentParent object.
[in]logWhere to log errors.
[in]autoReportAutomatically report errors.

◆ QtlErrorBase() [2/2]

QtlErrorBase::QtlErrorBase ( const QtlErrorBase other)
protected

Copy constructor.

The new object has no parent, it does not copy other's parent.

Parameters
[in]otherOther instance to copy.

Member Function Documentation

◆ log()

QtlLogger* QtlErrorBase::log ( ) const
inline

Get the error logger.

Returns
The error logger. Never null, can always be used.

◆ valid()

bool QtlErrorBase::valid ( ) const
inline

Check if the object is valid for use.

Returns
True if the object is valid for use.

◆ success()

bool QtlErrorBase::success ( ) const
inline

Check if the last operation was successful.

Returns
True if the last operation was successful, false otherwise.

◆ errorMessage()

QString QtlErrorBase::errorMessage ( ) const
inline

Get the last error message.

If valid() is false, return the reason why the object is invalid.

Returns
An error message or the empty string if there was no error.

◆ autoReport()

bool QtlErrorBase::autoReport ( ) const
inline

Check if errors are automatically reported and displayed to the user.

Returns
True if errors are automatically reported, false otherwise.

◆ setAutoReport()

void QtlErrorBase::setAutoReport ( bool  autoReport)
inline

Set if errors are automatically reported and displayed to the user.

Parameters
[in]autoReportTrue if errors are automatically reported, false otherwise.

◆ operator=()

const QtlErrorBase & QtlErrorBase::operator= ( const QtlErrorBase other)
protected

Assignment operator.

The object's parent is unchanged.

Parameters
[in]otherOther instance to copy.

◆ setSuccess()

void QtlErrorBase::setSuccess ( ) const
protected

Report success of the last operation.

◆ invalidate()

void QtlErrorBase::invalidate ( )
protected

Invalidate this object without reporting a message.

◆ setError()

void QtlErrorBase::setError ( const QString &  message,
ErrorType  type = QTL_ERROR 
) const
protected

Set an error message.

Parameters
[in]messageThe error message.
[in]typeError type.

◆ reportError()

void QtlErrorBase::reportError ( const QString &  message = QString(),
bool  fatal = false 
) const
protected

Report an error message.

Parameters
[in]messageThe error message. If omitted, use the current error message of this instance. If still empty, do not report anything.
[in]fatalIf true, the application is aborted and this function never returns.

Member Data Documentation

◆ _nullLog

QtlNullLogger QtlErrorBase::_nullLog
staticprivate

A void error logger.

◆ _log

QtlLogger* QtlErrorBase::_log
private

Where to log errors, never null.

◆ _valid

bool QtlErrorBase::_valid
mutableprivate

True if the object is valid for use.

◆ _success

bool QtlErrorBase::_success
mutableprivate

True if last operation was successful.

◆ _autoReport

bool QtlErrorBase::_autoReport
mutableprivate

Automatically report errors.

◆ _errorMessage

QString QtlErrorBase::_errorMessage
mutableprivate

Error message.


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