Medical Imaging Interaction Toolkit  2018.4.99-6dfa915f
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 
103  Status(const Severity& severity, const QString& pluginId, int code, const QString& message,
104  const SourceLocation& sl);
105 
117  Status(const Severity& severity, const QString& pluginId, int code, const QString& message,
118  const ctkException& exc, const SourceLocation& sl);
119 
130  Status(const Severity& severity, const QString& pluginId, const QString& message,
131  const SourceLocation& sl);
132 
144  Status(const Severity& severity, const QString& pluginId, const QString& message,
145  const ctkException& exc, const SourceLocation& sl);
146 
147  /*
148  * Implements the corresponding method on <code>IStatus</code>.
149  */
150  QList<IStatus::Pointer> GetChildren() const override;
151 
152  /*
153  * Implements the corresponding method on <code>IStatus</code>.
154  */
155  int GetCode() const override;
156 
157  /*
158  * Implements the corresponding method on <code>IStatus</code>.
159  */
160  const ctkException* GetException() const override;
161 
162  /*
163  * Implements the corresponding method on <code>IStatus</code>.
164  */
165  QString GetMessage() const override;
166 
167  /*
168  * Implements the corresponding method on <code>IStatus</code>.
169  */
170  QString GetPlugin() const override;
171 
172  /*
173  * Implements the corresponding method on <code>IStatus</code>.
174  */
175  Severity GetSeverity() const override;
176 
177  /*
178  * Implements the corresponding method on <code>IStatus</code>.
179  */
180  bool IsMultiStatus() const override;
181 
182  /*
183  * Implements the corresponding method on <code>IStatus</code>.
184  */
185  bool IsOK() const override;
186 
187  /*
188  * Implements the corresponding method on <code>IStatus</code>.
189  */
190  bool Matches(const Severities& severityMask) const override;
191 
192  QString GetFileName() const override;
193 
194  QString GetMethodName() const override;
195 
196  int GetLineNumber() const override;
197 
198 
199 protected:
200 
206  virtual void SetCode(int code);
207 
214  virtual void SetException(const ctkException& exception);
215 
223  virtual void SetMessage(const QString& message);
224 
230  virtual void SetPlugin(const QString& pluginId);
231 
238  virtual void SetSeverity(const Severity& severity);
239 
240 
241 public:
242 
247  QString ToString() const override;
248 
249 };
250 
251 }
252 
253 #define BERRY_STATUS_LOC berry::Status::SourceLocation(__FILE__, __FUNCTION__, __LINE__)
254 
255 #endif /* BERRYSTATUS_H_ */
#define org_blueberry_core_runtime_EXPORT
SourceLocation(const QString &fileName=QString(), const QString &methodName=QString(), int lineNumber=0)
Definition: berryStatus.h:37