Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
berry::Status Class Reference

#include <berryStatus.h>

Inheritance diagram for berry::Status:
Collaboration diagram for berry::Status:

Classes

struct  SourceLocation
 

Public Member Functions

 Status (const Severity &severity, const QString &pluginId, int code, const QString &message, const SourceLocation &sl)
 
 Status (const Severity &severity, const QString &pluginId, int code, const QString &message, const ctkException &exc, const SourceLocation &sl)
 
 Status (const Severity &severity, const QString &pluginId, const QString &message, const SourceLocation &sl)
 
 Status (const Severity &severity, const QString &pluginId, const QString &message, const ctkException &exc, const SourceLocation &sl)
 
QList< IStatus::PointerGetChildren () const override
 
int GetCode () const override
 
const ctkException * GetException () const override
 
QString GetMessage () const override
 
QString GetPlugin () const override
 
Severity GetSeverity () const override
 
bool IsMultiStatus () const override
 
bool IsOK () const override
 
bool Matches (const Severities &severityMask) const override
 
QString GetFileName () const override
 
QString GetMethodName () const override
 
int GetLineNumber () const override
 
QString ToString () const override
 
- Public Member Functions inherited from berry::Object
virtual QString GetClassName () const
 
virtual Reflection::TypeInfo GetTypeInfo () const
 
virtual QList< Reflection::TypeInfoGetSuperclasses () const
 
virtual void Delete ()
 
QDebug Print (QDebug os, Indent Indent=0) const
 
virtual uint HashCode () const
 
virtual bool operator< (const Object *) const
 
void Register () const
 
void UnRegister (bool del=true) const
 
int GetReferenceCount () const
 
void SetReferenceCount (int)
 
void AddDestroyListener (const MessageAbstractDelegate<> &delegate) const
 
void RemoveDestroyListener (const MessageAbstractDelegate<> &delegate) const
 
virtual bool operator== (const Object *) const
 

Static Public Member Functions

static const IStatus::Pointer OK_STATUS (const SourceLocation &sl)
 
static const IStatus::Pointer CANCEL_STATUS (const SourceLocation &sl)
 
- Static Public Member Functions inherited from berry::IStatus
static const char * GetStaticClassName ()
 
- Static Public Member Functions inherited from berry::Object
static const char * GetStaticClassName ()
 
static Reflection::TypeInfo GetStaticTypeInfo ()
 
static QList< Reflection::TypeInfoGetStaticSuperclasses ()
 

Protected Member Functions

virtual void SetCode (int code)
 
virtual void SetException (const ctkException &exception)
 
virtual void SetMessage (const QString &message)
 
virtual void SetPlugin (const QString &pluginId)
 
virtual void SetSeverity (const Severity &severity)
 
- Protected Member Functions inherited from berry::Object
 Object ()
 
virtual ~Object ()
 
virtual QDebug PrintSelf (QDebug os, Indent indent) const
 
virtual QDebug PrintHeader (QDebug os, Indent indent) const
 
virtual QDebug PrintTrailer (QDebug os, Indent indent) const
 

Additional Inherited Members

- Public Types inherited from berry::IStatus
enum  Severity {
  OK_TYPE, INFO_TYPE, WARNING_TYPE, ERROR_TYPE,
  CANCEL_TYPE
}
 
typedef berry::IStatus Self
 
typedef berry::SmartPointer< SelfPointer
 
typedef berry::SmartPointer< const SelfConstPointer
 
typedef berry::WeakPointer< SelfWeakPtr
 
typedef berry::WeakPointer< const SelfConstWeakPtr
 
- Public Types inherited from berry::Object
typedef Object Self
 
typedef berry::SmartPointer< SelfPointer
 
typedef berry::SmartPointer< const SelfConstPointer
 
typedef berry::WeakPointer< SelfWeakPtr
 
typedef berry::WeakPointer< const SelfConstWeakPtr
 
- Protected Attributes inherited from berry::Object
QAtomicInt m_ReferenceCount
 
QMutex m_ReferenceCountLock
 

Detailed Description

A concrete status implementation, suitable either for instantiating or subclassing.

This class can be used without OSGi running.

Definition at line 34 of file berryStatus.h.

Constructor & Destructor Documentation

berry::Status::Status ( const Severity severity,
const QString &  pluginId,
int  code,
const QString &  message,
const SourceLocation sl 
)

Creates a new status object. The created status has no children.

Parameters
severitythe severity; one of OK, ERROR, INFO, WARNING, or CANCEL
pluginIdthe unique identifier of the relevant plug-in
codethe plug-in-specific status code, or OK
messagea human-readable message, localized to the current locale

Definition at line 42 of file berryStatus.cpp.

References SetCode(), SetMessage(), SetPlugin(), and SetSeverity().

Referenced by CANCEL_STATUS(), and OK_STATUS().

berry::Status::Status ( const Severity severity,
const QString &  pluginId,
int  code,
const QString &  message,
const ctkException &  exc,
const SourceLocation sl 
)

Creates a new status object. The created status has no children.

Parameters
severitythe severity; one of OK, ERROR, INFO, WARNING, or CANCEL
pluginIdthe unique identifier of the relevant plug-in
codethe plug-in-specific status code, or OK
messagea human-readable message, localized to the current locale
exceptiona low-level exception.

Definition at line 52 of file berryStatus.cpp.

References SetCode(), SetException(), SetMessage(), SetPlugin(), and SetSeverity().

berry::Status::Status ( const Severity severity,
const QString &  pluginId,
const QString &  message,
const SourceLocation sl 
)

Simplified constructor of a new status object; assumes that code is OK. The created status has no children.

Parameters
severitythe severity; one of OK, ERROR, INFO, WARNING, or CANCEL
pluginIdthe unique identifier of the relevant plug-in
messagea human-readable message, localized to the current locale

Definition at line 64 of file berryStatus.cpp.

References SetCode(), SetMessage(), SetPlugin(), and SetSeverity().

berry::Status::Status ( const Severity severity,
const QString &  pluginId,
const QString &  message,
const ctkException &  exc,
const SourceLocation sl 
)

Simplified constructor of a new status object; assumes that code is OK. The created status has no children.

Parameters
severitythe severity; one of OK, ERROR, INFO, WARNING, or CANCEL
pluginIdthe unique identifier of the relevant plug-in
messagea human-readable message, localized to the current locale
exceptiona low-level exception.

Definition at line 74 of file berryStatus.cpp.

References SetCode(), SetException(), SetMessage(), SetPlugin(), and SetSeverity().

Member Function Documentation

const IStatus::Pointer berry::Status::CANCEL_STATUS ( const SourceLocation sl)
static

A standard CANCEL status with no message.

Definition at line 35 of file berryStatus.cpp.

References berry::IStatus::CANCEL_TYPE, and Status().

QList< IStatus::Pointer > berry::Status::GetChildren ( ) const
overridevirtual

Returns a list of status object immediately contained in this multi-status, or an empty list if this is not a multi-status.

Returns
an array of status objects
See also
#isMultiStatus()

Implements berry::IStatus.

Definition at line 86 of file berryStatus.cpp.

int berry::Status::GetCode ( ) const
overridevirtual

Returns the plug-in-specific status code describing the outcome.

Returns
plug-in-specific status code

Implements berry::IStatus.

Definition at line 91 of file berryStatus.cpp.

const ctkException * berry::Status::GetException ( ) const
overridevirtual

Returns the relevant low-level exception, or null if none. For example, when an operation fails because of a network communications failure, this might return the java.io.IOException describing the exact nature of that failure.

Returns
the relevant low-level exception, or null if none

Implements berry::IStatus.

Definition at line 96 of file berryStatus.cpp.

QString berry::Status::GetFileName ( ) const
overridevirtual

Implements berry::IStatus.

Definition at line 134 of file berryStatus.cpp.

References berry::Status::SourceLocation::fileName.

int berry::Status::GetLineNumber ( ) const
overridevirtual

Implements berry::IStatus.

Definition at line 144 of file berryStatus.cpp.

References berry::Status::SourceLocation::lineNumber.

QString berry::Status::GetMessage ( ) const
overridevirtual

Returns the message describing the outcome. The message is localized to the current locale.

Returns
a localized message

Implements berry::IStatus.

Definition at line 104 of file berryStatus.cpp.

QString berry::Status::GetMethodName ( ) const
overridevirtual

Implements berry::IStatus.

Definition at line 139 of file berryStatus.cpp.

References berry::Status::SourceLocation::methodName.

QString berry::Status::GetPlugin ( ) const
overridevirtual

Returns the unique identifier of the plug-in associated with this status (this is the plug-in that defines the meaning of the status code).

Returns
the unique identifier of the relevant plug-in

Implements berry::IStatus.

Definition at line 109 of file berryStatus.cpp.

IStatus::Severity berry::Status::GetSeverity ( ) const
overridevirtual

Returns the severity. The severities are as follows (in descending order):

  • CANCEL_TYPE - cancelation occurred
  • ERROR_TYPE - a serious error (most severe)
  • WARNING_TYPE - a warning (less severe)
  • INFO_TYPE - an informational ("fyi") message (least severe)
  • OK_TYPE - everything is just fine

The severity of a multi-status is defined to be the maximum severity of any of its children, or OK if it has no children.

Returns
the severity: one of OK_TYPE, ERROR_TYPE, INFO_TYPE, WARNING_TYPE, or CANCEL_TYPE
See also
#matches(int)

Implements berry::IStatus.

Definition at line 114 of file berryStatus.cpp.

Referenced by berry::MultiStatus::Add().

bool berry::Status::IsMultiStatus ( ) const
overridevirtual

Returns whether this status is a multi-status. A multi-status describes the outcome of an operation involving multiple operands.

The severity of a multi-status is derived from the severities of its children; a multi-status with no children is OK_TYPE by definition. A multi-status carries a plug-in identifier, a status code, a message, and an optional exception. Clients may treat multi-status objects in a multi-status unaware way.

Returns
true for a multi-status, false otherwise
See also
#getChildren()

Implements berry::IStatus.

Definition at line 119 of file berryStatus.cpp.

bool berry::Status::IsOK ( ) const
overridevirtual

Returns whether this status indicates everything is okay (neither info, warning, nor error).

Returns
true if this status has severity OK, and false otherwise

Implements berry::IStatus.

Definition at line 124 of file berryStatus.cpp.

References berry::IStatus::OK_TYPE.

bool berry::Status::Matches ( const Severities &  severityMask) const
overridevirtual

Returns whether the severity of this status matches the given severity mask. Note that a status with severity OK_TYPE will never match; use isOK instead to detect a status with a severity of OK.

Parameters
severityMaska mask formed by bitwise or'ing severity mask constants (ERROR_TYPE, WARNING_TYPE, INFO_TYPE, CANCEL_TYPE)
Returns
true if there is at least one match, false if there are no matches
See also
#getSeverity()
CANCEL_TYPE
ERROR_TYPE
WARNING_TYPE
INFO_TYPE

Implements berry::IStatus.

Definition at line 129 of file berryStatus.cpp.

const IStatus::Pointer berry::Status::OK_STATUS ( const SourceLocation sl)
static

A standard OK status with an "ok" message.

Definition at line 28 of file berryStatus.cpp.

References berry::IStatus::OK_TYPE, and Status().

void berry::Status::SetCode ( int  code)
protectedvirtual

Sets the status code.

Parameters
codethe plug-in-specific status code, or OK

Definition at line 149 of file berryStatus.cpp.

Referenced by Status().

void berry::Status::SetException ( const ctkException &  exception)
protectedvirtual

Sets the exception.

Parameters
exceptiona low-level exception, or null if not applicable

Definition at line 154 of file berryStatus.cpp.

Referenced by Status().

void berry::Status::SetMessage ( const QString &  message)
protectedvirtual

Sets the message. If null is passed, message is set to an empty string.

Parameters
messagea human-readable message, localized to the current locale

Definition at line 160 of file berryStatus.cpp.

Referenced by Status().

void berry::Status::SetPlugin ( const QString &  pluginId)
protectedvirtual

Sets the plug-in id.

Parameters
pluginIdthe unique identifier of the relevant plug-in

Definition at line 165 of file berryStatus.cpp.

Referenced by Status().

void berry::Status::SetSeverity ( const Severity severity)
protectedvirtual

Sets the severity.

Parameters
severitythe severity; one of OK, ERROR, INFO, WARNING, or CANCEL

Definition at line 171 of file berryStatus.cpp.

Referenced by berry::MultiStatus::Add(), berry::MultiStatus::MultiStatus(), and Status().

QString berry::Status::ToString ( ) const
overridevirtual

Returns a string representation of the status, suitable for debugging purposes only.

Reimplemented from berry::Object.

Definition at line 176 of file berryStatus.cpp.

References berry::IStatus::CANCEL_TYPE, berry::IStatus::ERROR_TYPE, berry::IStatus::INFO_TYPE, berry::IStatus::OK_TYPE, and berry::IStatus::WARNING_TYPE.

Referenced by berry::MultiStatus::ToString().


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