14 #ifndef BERRYISERVICELOCATOR_H_
15 #define BERRYISERVICELOCATOR_H_
62 const char* typeName = qobject_interface_iid<S*>();
63 if (typeName ==
nullptr)
65 BERRY_WARN <<
"Error getting service: Cannot get the interface id for type '" << Reflection::GetClassName<S>()
66 <<
"'. It is probably missing a Q_DECLARE_INTERFACE macro in its header.";
69 Object* obj = this->GetService(typeName);
70 S* service =
dynamic_cast<S*
>(obj);
71 if (obj !=
nullptr && service ==
nullptr)
73 BERRY_WARN <<
"Error getting service: Class '" << obj->
GetClassName() <<
"' cannot be cast to service interface "
74 <<
"'" << Reflection::GetClassName<S>() <<
"'";
94 return this->HasService(qobject_interface_iid<S*>());
97 virtual Object* GetService(
const QString& api) = 0;
98 virtual bool HasService(
const QString& api)
const = 0;