Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
berryStatus.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 BlueBerry Platform
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 
18 #ifndef BERRYSTATUS_H_
19 #define BERRYSTATUS_H_
20 
21 #include "berryIStatus.h"
22 
24 
25 namespace berry {
26 
35 {
36 
37 public:
38 
39  struct SourceLocation {
40 
41  SourceLocation(const QString& fileName = QString(), const QString& methodName = QString(), int lineNumber = 0)
42  : fileName(fileName), methodName(methodName), lineNumber(lineNumber)
43  {}
44 
45  const QString fileName;
46  const QString methodName;
47  const int lineNumber;
48  };
49 
50 private:
51 
62  Severity severity;
63 
66  QString pluginId;
67 
70  int code;
71 
74  QString message;
75 
78  ctkException* exception;
79 
82  static const QList<IStatus::Pointer> theEmptyStatusArray;
83 
84  SourceLocation sourceLocation;
85 
86 public:
87 
91  static const IStatus::Pointer OK_STATUS(const SourceLocation& sl);
95  static const IStatus::Pointer CANCEL_STATUS(const SourceLocation& sl);
96 
107  Status(const Severity& severity, const QString& pluginId, int code, const QString& message,
108  const SourceLocation& sl);
109 
121  Status(const Severity& severity, const QString& pluginId, int code, const QString& message,
122  const ctkException& exc, const SourceLocation& sl);
123 
134  Status(const Severity& severity, const QString& pluginId, const QString& message,
135  const SourceLocation& sl);
136 
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_ */
#define org_blueberry_core_runtime_EXPORT
SourceLocation(const QString &fileName=QString(), const QString &methodName=QString(), int lineNumber=0)
Definition: berryStatus.h:41