Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
berryStatus.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 
14 #ifndef BERRYSTATUS_H_
15 #define BERRYSTATUS_H_
16 
17 #include "berryIStatus.h"
18 
20 
21 namespace berry {
22 
31 {
32 
33 public:
34 
35  struct SourceLocation {
36 
37  SourceLocation(const QString& fileName = QString(), const QString& methodName = QString(), int lineNumber = 0)
38  : fileName(fileName), methodName(methodName), lineNumber(lineNumber)
39  {}
40 
41  const QString fileName;
42  const QString methodName;
43  const int lineNumber;
44  };
45 
46 private:
47 
58  Severity severity;
59 
62  QString pluginId;
63 
66  int code;
67 
70  QString message;
71 
74  ctkException* exception;
75 
78  static const QList<IStatus::Pointer> theEmptyStatusArray;
79 
80  SourceLocation sourceLocation;
81 
82 public:
83 
87  static const IStatus::Pointer OK_STATUS(const SourceLocation& sl);
91  static const IStatus::Pointer CANCEL_STATUS(const SourceLocation& sl);
92 
104  Status(const Severity& severity, const QString& pluginId, int code, const QString& message,
105  const SourceLocation& sl);
106 
119  Status(const Severity& severity, const QString& pluginId, int code, const QString& message,
120  const ctkException& exc, const SourceLocation& sl);
121 
133  Status(const Severity& severity, const QString& pluginId, const QString& message,
134  const SourceLocation& sl);
135 
148  Status(const Severity& severity, const QString& pluginId, const QString& message,
149  const ctkException& exc, const SourceLocation& sl);
150 
151  /*
152  * Implements the corresponding method on <code>IStatus</code>.
153  */
154  QList<IStatus::Pointer> GetChildren() const override;
155 
156  /*
157  * Implements the corresponding method on <code>IStatus</code>.
158  */
159  int GetCode() const override;
160 
161  /*
162  * Implements the corresponding method on <code>IStatus</code>.
163  */
164  const ctkException* GetException() const override;
165 
166  /*
167  * Implements the corresponding method on <code>IStatus</code>.
168  */
169  QString GetMessage() const override;
170 
171  /*
172  * Implements the corresponding method on <code>IStatus</code>.
173  */
174  QString GetPlugin() const override;
175 
176  /*
177  * Implements the corresponding method on <code>IStatus</code>.
178  */
179  Severity GetSeverity() const override;
180 
181  /*
182  * Implements the corresponding method on <code>IStatus</code>.
183  */
184  bool IsMultiStatus() const override;
185 
186  /*
187  * Implements the corresponding method on <code>IStatus</code>.
188  */
189  bool IsOK() const override;
190 
191  /*
192  * Implements the corresponding method on <code>IStatus</code>.
193  */
194  bool Matches(const Severities& severityMask) const override;
195 
196  QString GetFileName() const override;
197 
198  QString GetMethodName() const override;
199 
200  int GetLineNumber() const override;
201 
202 
203 protected:
204 
210  virtual void SetCode(int code);
211 
218  virtual void SetException(const ctkException& exception);
219 
227  virtual void SetMessage(const QString& message);
228 
234  virtual void SetPlugin(const QString& pluginId);
235 
242  virtual void SetSeverity(const Severity& severity);
243 
244 
245 public:
246 
251  QString ToString() const override;
252 
253 };
254 
255 }
256 
257 #define BERRY_STATUS_LOC berry::Status::SourceLocation(__FILE__, __FUNCTION__, __LINE__)
258 
259 #endif /* BERRYSTATUS_H_ */
org_blueberry_core_runtime_Export.h
berry::Status::SourceLocation::methodName
const QString methodName
Definition: berryStatus.h:42
berry::Status::SourceLocation::fileName
const QString fileName
Definition: berryStatus.h:41
berry::Status
Definition: berryStatus.h:30
berry::Status::SourceLocation::lineNumber
const int lineNumber
Definition: berryStatus.h:43
org_blueberry_core_runtime_EXPORT
#define org_blueberry_core_runtime_EXPORT
Definition: org_blueberry_core_runtime_Export.h:26
berry::Status::SourceLocation::SourceLocation
SourceLocation(const QString &fileName=QString(), const QString &methodName=QString(), int lineNumber=0)
Definition: berryStatus.h:37
berry::IStatus
Definition: berryIStatus.h:52
berry::Object::Pointer
berry::SmartPointer< Self > Pointer
Definition: berryObject.h:82
berry::IStatus::Severity
Severity
Definition: berryIStatus.h:56
berryIStatus.h
berry::Status::SourceLocation
Definition: berryStatus.h:35
berry
Definition: QmitkPropertyItemModel.h:24