Qx v0.5.7
Qt Extensions Library
Loading...
Searching...
No Matches
Qx::GenericError Class Referencefinal

The GenericError class is multi-purpose container for storing error information. More...

#include <qx/core/qx-genericerror.h>

Collaboration diagram for Qx::GenericError:
[legend]

Public Member Functions

 GenericError ()
 
 GenericError (Severity severity, quint32 value, const QString &primary, const QString &secondary={}, const QString &details={}, const QString &caption={})
 
QString caption () const
 
QString details () const
 
bool isValid () const
 
bool operator!= (const GenericError &other) const =default
 
bool operator== (const GenericError &other) const =default
 
QString primary () const
 
QString secondary () const
 
GenericErrorsetCaption (const QString &caption)
 
GenericErrorsetDetails (const QString &details)
 
GenericErrorsetPrimary (const QString &primary)
 
GenericErrorsetSecondary (const QString &secondary)
 
GenericErrorsetSeverity (Severity sv)
 
Severity severity () const
 
quint32 value () const
 
GenericError withSeverity (Severity sv)
 
- Public Member Functions inherited from Qx::AbstractError<"Qx::GenericError", 999 >
 operator bool () const
 
bool operator!= (const AbstractError &other) const=default
 
bool operator== (const AbstractError &other) const=default
 

Additional Inherited Members

- Static Public Attributes inherited from Qx::AbstractError<"Qx::GenericError", 999 >
static constexpr quint16 TYPE_CODE
 
static constexpr QLatin1StringView TYPE_NAME
 
- Protected Member Functions inherited from Qx::IError
 IError ()=default
 
bool operator!= (const IError &other) const =default
 
bool operator== (const IError &other) const =default
 

Detailed Description

This class holds no association with any particular procedure, operation, or state, and instead acts as a simple implementation of the Error interface that allows for setting its underlying fields directly.

More application specific derivations of AbstractError should be preferred, but this class is useful in situations where the need for encapsulating error info is basic and sporadic.

Note
Because there are no constraints on the situations in which this class may be used, it is recommended to utilize a widely accessible enumerated type to store possible error values in order to promote uniqueness.
See also
Error

Constructor & Destructor Documentation

◆ GenericError() [1/2]

Qx::GenericError::GenericError ( )

Constructs an invalid generic error.

See also
isValid().

◆ GenericError() [2/2]

Qx::GenericError::GenericError ( Severity severity,
quint32 value,
const QString & primary,
const QString & secondary = {},
const QString & details = {},
const QString & caption = {} )

Constructs a generic error with the given severity, value and primary info, as well as the optional secondary info, details and caption.

Member Function Documentation

◆ caption()

QString Qx::GenericError::caption ( ) const

Returns the generic error's caption.

See also
setCaption() and Error::caption().

◆ details()

QString Qx::GenericError::details ( ) const

Returns the generic error's details.

See also
setDetails() and Error::details().

◆ isValid()

bool Qx::GenericError::isValid ( ) const

Returns true if the generic error is valid; otherwise returns false.

See also
Error::isValid().

◆ operator!=()

bool Qx::GenericError::operator!= ( const GenericError & other) const
default

Returns true if this error is not the same as other; otherwise, returns false.

◆ operator==()

bool Qx::GenericError::operator== ( const GenericError & other) const
default

Returns true if this error is the same as other; otherwise, returns false.

See also
equivalent().

◆ primary()

QString Qx::GenericError::primary ( ) const

Returns the generic error's primary information.

See also
setPrimary() and Error::primary().

◆ secondary()

QString Qx::GenericError::secondary ( ) const

Returns the generic error's secondary information.

See also
setPrimary() and Error::secondary().

◆ setCaption()

GenericError & Qx::GenericError::setCaption ( const QString & caption)

Sets the generic error's caption to caption and returns a reference to the error.

See also
caption() and Error::caption().

◆ setDetails()

GenericError & Qx::GenericError::setDetails ( const QString & details)

Sets the generic error's details to details and returns a reference to the error.

See also
details() and Error::details().

◆ setPrimary()

GenericError & Qx::GenericError::setPrimary ( const QString & primary)

Sets the generic error's primary information to primary and returns a reference to the error.

See also
caption() and Error::caption().

◆ setSecondary()

GenericError & Qx::GenericError::setSecondary ( const QString & secondary)

Sets the generic error's secondary information to secondary and returns a reference to the error.

See also
secondary() and Error::secondary().

◆ setSeverity()

GenericError & Qx::GenericError::setSeverity ( Severity sv)

Sets the generic error's severity to sv and returns a reference to the error.

See also
severity(), withSeverity() and Error::severity().

◆ severity()

Severity Qx::GenericError::severity ( ) const

Returns the generic error's severity.

See also
setSeverity(), withSeverity() and Error::severity().

◆ value()

quint32 Qx::GenericError::value ( ) const

Returns the generic error's value

See also
setValue() and Error::value().

◆ withSeverity()

GenericError Qx::GenericError::withSeverity ( Severity sv)

Returns a copy of the generic error with a severity of sv.

See also
severity(), setSeverity() and Error::severity().

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