23 #ifndef _TelepathyQt_optional_interface_factory_h_HEADER_GUARD_ 
   24 #define _TelepathyQt_optional_interface_factory_h_HEADER_GUARD_ 
   26 #ifndef IN_TP_QT_HEADER 
   27 #error IN_TP_QT_HEADER 
   30 #include <TelepathyQt/Global> 
   33 #include <QStringList> 
   39 class AbstractInterface;
 
   41 #ifndef DOXYGEN_SHOULD_SKIP_THIS 
   43 class TP_QT_EXPORT OptionalInterfaceCache
 
   45     Q_DISABLE_COPY(OptionalInterfaceCache)
 
   48     explicit OptionalInterfaceCache(QObject *proxy);
 
   50     ~OptionalInterfaceCache();
 
   53     AbstractInterface *getCached(const QString &name) const;
 
   54     void cache(AbstractInterface *interface) const;
 
   55     QObject *proxy() const;
 
   59     friend struct Private;
 
   66 #ifndef DOXYGEN_SHOULD_SKIP_THIS
 
   67     : 
private OptionalInterfaceCache
 
   80         : OptionalInterfaceCache(this_)
 
   88     inline QStringList 
interfaces()
 const { 
return mInterfaces; }
 
   92         return mInterfaces.contains(name);
 
   95     template <
class Interface>
 
  102         QString name( (QLatin1String(Interface::staticInterfaceName())) );
 
  103         if (check == CheckInterfaceSupported && !mInterfaces.contains(name)) {
 
  108         return interface<Interface>();
 
  111     template <
typename Interface>
 
  114         AbstractInterface* interfaceMustBeASubclassOfAbstractInterface = 
static_cast<Interface *
>(NULL);
 
  115         Q_UNUSED(interfaceMustBeASubclassOfAbstractInterface);
 
  120         QString name( (QLatin1String(Interface::staticInterfaceName())) );
 
  123             return static_cast<Interface *
>(cached);
 
  126         Interface *
interface = new Interface(
 
  127                 static_cast<DBusProxySubclass *>(proxy()));
 
  135         mInterfaces = interfaces;
 
  139     QStringList mInterfaces;
 
Interface * optionalInterface(InterfaceSupportedChecking check=CheckInterfaceSupported) const 
Definition: optional-interface-factory.h:96
bool hasInterface(const QString &name) const 
Definition: optional-interface-factory.h:90
The AbstractInterface class is the base class for all client side D-Bus interfaces, allowing access to remote methods/properties/signals. 
Definition: abstract-interface.h:42
OptionalInterfaceFactory(DBusProxySubclass *this_)
Definition: optional-interface-factory.h:79
Interface * interface() const 
Definition: optional-interface-factory.h:112
InterfaceSupportedChecking
Definition: optional-interface-factory.h:73
Definition: optional-interface-factory.h:75
~OptionalInterfaceFactory()
Definition: optional-interface-factory.h:84
QStringList interfaces() const 
Definition: optional-interface-factory.h:88
void setInterfaces(const QStringList &interfaces)
Definition: optional-interface-factory.h:133
The OptionalInterfaceFactory class is a helper class for high-level D-Bus proxy classes willing to of...
Definition: optional-interface-factory.h:65