1 #ifndef CTL_SYSTEMCOMPONENT_H 2 #define CTL_SYSTEMCOMPONENT_H 63 virtual QString
info() const;
70 const QString&
name() const;
87 template <typename ComponentType, typename... ConstructorArguments>
89 typename std::enable_if<std::is_convertible<ComponentType*,
SystemComponent*>::value,
90 std::unique_ptr<ComponentType>>::
type 92 return std::unique_ptr<ComponentType>(
93 new ComponentType(std::forward<ConstructorArguments>(arguments)...));
98 bool fallbackToGenericType =
false);
148 #define DECLARE_ELEMENTAL_TYPE \ 150 int elementalType() const final { return Type; } \ 184 #endif // CTL_SYSTEMCOMPONENT_H std::unique_ptr< SystemComponent > makeComponentFromJson(const QJsonObject &object, bool fallbackToGenericType)
void rename(QString name)
Definition: systemcomponent.cpp:47
std::unique_ptr< ComponentType > makeComponent(ConstructorArguments &&... arguments)
Definition: systemcomponent.h:88
static QString typeInfoString(const std::type_info &type)
Definition: systemcomponent.cpp:52
virtual QString info() const
Definition: systemcomponent.cpp:29
const QString & name() const
Definition: systemcomponent.cpp:42
QVariant toVariant() const override
Definition: systemcomponent.cpp:64
Specify an interface for de-/serialization from/to QVariants.
Definition: serializationinterface.h:17
QString _name
The component's name.
Definition: systemcomponent.h:83
Base class for all system components.
Definition: systemcomponent.h:53
static QString defaultName()
Definition: systemcomponent.cpp:19
#define CTL_TYPE_ID(newIndex)
Definition: serializationinterface.h:189
virtual SystemComponent * clone() const
Definition: systemcomponent.cpp:37
void fromVariant(const QVariant &variant) override
Definition: systemcomponent.cpp:58
int type() const override
Definition: systemcomponent.h:55
virtual int elementalType() const
Definition: systemcomponent.h:135