Medical Imaging Interaction Toolkit  2022.04.99-01b95b17
Medical Imaging Interaction Toolkit
berryIConfigurationElement.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 #ifndef BERRYIEXTENSIONELEMENT_H_
14 #define BERRYIEXTENSIONELEMENT_H_
15 
16 #include <berryObject.h>
17 
18 #include <berryLog.h>
19 
20 namespace berry {
21 
22 struct IContributor;
23 struct IExtension;
24 
25 class Handle;
26 
60 {
61 
63 
64  ~IConfigurationElement() override;
65 
98  virtual QObject* CreateExecutableExtension(const QString& propertyName) const = 0;
99 
100  template<class C>
101  C* CreateExecutableExtension(const QString &propertyName) const
102  {
103  C* interface = qobject_cast<C*>(this->CreateExecutableExtension(propertyName));
104  if (interface == nullptr)
105  {
106  BERRY_WARN << "The QObject subclass " << this->GetAttribute(propertyName).toStdString()
107  << " does not seem to implement the required interface \""
108  << qobject_interface_iid<C*>() << "\", or you forgot the Q_INTERFACES macro.";
109  }
110  return interface;
111  }
112 
135  virtual QString GetAttribute(const QString& name) const = 0;
136 
155  virtual QList<QString> GetAttributeNames() const = 0;
156 
178  virtual QList<IConfigurationElement::Pointer> GetChildren() const = 0;
179 
189  virtual QList<IConfigurationElement::Pointer> GetChildren(const QString& name) const = 0;
190 
197  virtual SmartPointer<IExtension> GetDeclaringExtension() const = 0;
198 
212  virtual QString GetName() const = 0;
213 
225  virtual SmartPointer<Object> GetParent() const = 0;
226 
244  virtual QString GetValue() const = 0;
245 
263  virtual QString GetValue(const QLocale& locale) const = 0;
264 
271  virtual QString GetNamespaceIdentifier() const = 0;
272 
279  virtual SmartPointer<IContributor> GetContributor() const = 0;
280 
287  virtual bool IsValid() const = 0;
288 
289 };
290 
291 } // namespace berry
292 
293 Q_DECLARE_INTERFACE(berry::IConfigurationElement, "org.blueberry.core.IConfigurationElement")
294 
295 
296 #endif /*BERRYIEXTENSIONELEMENT_H_*/
Light weight base class for most BlueBerry classes.
Definition: berryObject.h:72
C * CreateExecutableExtension(const QString &propertyName) const
Implements transparent reference counting.
#define org_blueberry_core_runtime_EXPORT
#define berryObjectMacro(...)
Definition: berryMacros.h:33
#define BERRY_WARN
Definition: berryLog.h:21