QXmpp  Version:0.9.1
QXmppInvokable.h
1 /*
2  * Copyright (C) 2008-2014 The QXmpp developers
3  *
4  * Authors:
5  * Ian Reinhart Geiser
6  *
7  * Source:
8  * https://github.com/qxmpp-project/qxmpp
9  *
10  * This file is a part of QXmpp library.
11  *
12  * This library is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public
14  * License as published by the Free Software Foundation; either
15  * version 2.1 of the License, or (at your option) any later version.
16  *
17  * This library is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  * Lesser General Public License for more details.
21  *
22  */
23 
24 #ifndef QXMPPINVOKABLE_H
25 #define QXMPPINVOKABLE_H
26 
27 #include <QObject>
28 #include <QHash>
29 #include <QVariant>
30 #include <QWriteLocker>
31 #include <QStringList>
32 
33 #include "QXmppGlobal.h"
34 
40 class QXMPP_EXPORT QXmppInvokable : public QObject
41 {
42  Q_OBJECT
43 public:
44  QXmppInvokable( QObject *parent = 0 );
45 
46  ~QXmppInvokable();
47 
53  QVariant dispatch( const QByteArray &method, const QList<QVariant> &args = QList<QVariant>() );
54 
59  static QList<QByteArray> paramTypes( const QList<QVariant> &params );
60 
64  virtual bool isAuthorized( const QString &jid ) const = 0;
65 
66 public slots:
70  QStringList interfaces() const;
71 
72 private:
73  void buildMethodHash();
74  QHash<QByteArray,int> m_methodHash;
75  QReadWriteLock m_lock;
76 };
77 
78 
79 #endif
Definition: QXmppInvokable.h:40