27 #ifndef SERVICEMANAGER_H
28 #define SERVICEMANAGER_H
33 namespace qutim_sdk_0_3
36 class ServiceManagerPrivate;
42 typedef QWeakPointer<ServicePointerData>
Ptr;
54 Q_PROPERTY(
bool inited READ isInited NOTIFY initedChanged)
56 static
bool isInited();
57 static QObject *getByName(const QByteArray &name);
59 static inline T getByName(const QByteArray &name)
61 static QList<QByteArray> names();
71 static bool setImplementation(
const QByteArray &name,
const ExtensionInfo &info);
76 void serviceChanged(
const QByteArray &name, QObject *newObject, QObject *oldObject);
77 void serviceChanged(QObject *newObject, QObject *oldObject);
78 void initedChanged(
bool inited =
true);
92 QScopedPointer<ServiceManagerPrivate> d_ptr;
106 inline QByteArray
name()
const {
return d ? d.data()->name : QByteArray(); }
107 inline T *
data()
const {
return qobject_cast<T*>(d ? d.data()->object : 0); }
110 inline operator bool()
const {
return d && d.data()->object; }
111 inline operator T*()
const {
return data(); }
119 template <
typename T>
122 return getDataHelper<T>(
reinterpret_cast<T*
>(0));
125 template <
typename T>
128 return getData(&T::staticMetaObject);
131 template <
typename T>
134 return getData(qobject_interface_iid<T*>());
139 #endif // SERVICEMANAGER_H