18 #ifndef BERRYISERVICELOCATOR_H_
19 #define BERRYISERVICELOCATOR_H_
66 const char* typeName = qobject_interface_iid<S*>();
67 if (typeName ==
nullptr)
69 BERRY_WARN <<
"Error getting service: Cannot get the interface id for type '" << Reflection::GetClassName<S>()
70 <<
"'. It is probably missing a Q_DECLARE_INTERFACE macro in its header.";
73 Object* obj = this->GetService(typeName);
74 S* service =
dynamic_cast<S*
>(obj);
75 if (obj !=
nullptr && service ==
nullptr)
77 BERRY_WARN <<
"Error getting service: Class '" << obj->
GetClassName() <<
"' cannot be cast to service interface "
78 <<
"'" << Reflection::GetClassName<S>() <<
"'";
98 return this->HasService(qobject_interface_iid<S*>());
101 virtual Object* GetService(
const QString& api) = 0;
102 virtual bool HasService(
const QString& api)
const = 0;
Light weight base class for most BlueBerry classes.
#define berryObjectMacro(...)
virtual QString GetClassName() const