Medical Imaging Interaction Toolkit  2018.4.99-3e3f1a6e
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 
61 {
62 
64 
65  ~IConfigurationElement() override;
66 
99  virtual QObject* CreateExecutableExtension(const QString& propertyName) const = 0;
100 
101  template<class C>
102  C* CreateExecutableExtension(const QString &propertyName) const
103  {
104  C* interface = qobject_cast<C*>(this->CreateExecutableExtension(propertyName));
105  if (interface == nullptr)
106  {
107  BERRY_WARN << "The QObject subclass " << this->GetAttribute(propertyName).toStdString()
108  << " does not seem to implement the required interface \""
109  << qobject_interface_iid<C*>() << "\", or you forgot the Q_INTERFACES macro.";
110  }
111  return interface;
112  }
113 
136  virtual QString GetAttribute(const QString& name) const = 0;
137 
156  virtual QList<QString> GetAttributeNames() const = 0;
157 
180  virtual QList<IConfigurationElement::Pointer> GetChildren() const = 0;
181 
192  virtual QList<IConfigurationElement::Pointer> GetChildren(const QString& name) const = 0;
193 
200  virtual SmartPointer<IExtension> GetDeclaringExtension() const = 0;
201 
215  virtual QString GetName() const = 0;
216 
228  virtual SmartPointer<Object> GetParent() const = 0;
229 
247  virtual QString GetValue() const = 0;
248 
267  virtual QString GetValue(const QLocale& locale) const = 0;
268 
275  virtual QString GetNamespaceIdentifier() const = 0;
276 
283  virtual SmartPointer<IContributor> GetContributor() const = 0;
284 
291  virtual bool IsValid() const = 0;
292 
293 };
294 
295 } // namespace berry
296 
297 Q_DECLARE_INTERFACE(berry::IConfigurationElement, "org.blueberry.core.IConfigurationElement")
298 
299 
300 #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
#define GetAttribute(name, type)
static std::string GetName(std::string fileName, std::string suffix)