24 #ifndef GAMMARAY_METAOBJECT_H
25 #define GAMMARAY_METAOBJECT_H
27 #include "gammaray_core_export.h"
29 #include "metaproperty.h"
45 int propertyCount()
const;
59 QString className()
const;
65 void *castForPropertyAt(
void *
object,
int index)
const;
67 void setClassName(
const QString &className);
70 bool inherits(
const QString &className)
const;
76 virtual void *castToBaseClass(
void *
object,
int baseClassIndex)
const = 0;
79 QVector<MetaObject*> m_baseClasses;
82 QVector<MetaProperty*> m_properties;
87 template <
typename T,
typename Base1 =
void,
typename Base2 =
void,
typename Base3 =
void>
93 Q_ASSERT(baseClassIndex >= 0 && baseClassIndex < m_baseClasses.size());
94 switch (baseClassIndex) {
96 return static_cast<Base1*
>(
static_cast<T*
>(object));
98 return static_cast<Base2*
>(
static_cast<T*
>(object));
100 return static_cast<Base3*
>(
static_cast<T*
>(object));
109 #endif // GAMMARAY_METAOBJECT_H