Content Hub  1.0.0
A session-wide content-exchange service
item.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2013 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License version 3 as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Thomas Voß <thomas.voss@canonical.com>
17  */
18 #ifndef COM_LOMIRI_CONTENT_ITEM_H_
19 #define COM_LOMIRI_CONTENT_ITEM_H_
20 
21 #include <QtDBus>
22 #include <QObject>
23 #include <QSharedPointer>
24 #include <QUrl>
25 
26 namespace com
27 {
28 namespace lomiri
29 {
30 namespace content
31 {
32 
33 class Item : public QObject
34 {
35  Q_OBJECT
36  Q_PROPERTY(QUrl url READ url() WRITE setUrl)
37  Q_PROPERTY(QString name READ name WRITE setName)
38  Q_PROPERTY(QString text READ text WRITE setText)
39  Q_PROPERTY(QByteArray stream READ stream WRITE setStream)
40  Q_PROPERTY(QString streamType READ streamType WRITE setStreamType)
41 
42  public:
43  Item(const QUrl& = QUrl(), QObject* = nullptr);
44  Item(const Item&);
45  virtual ~Item();
46 
47  Item& operator=(const Item&);
48  bool operator==(const Item&) const;
49 
50  Q_INVOKABLE const QUrl& url() const;
51  Q_INVOKABLE void setUrl(const QUrl &url) const;
52  Q_INVOKABLE const QString& name() const;
53  Q_INVOKABLE void setName(const QString &name) const;
54  Q_INVOKABLE const QString text() const;
55  Q_INVOKABLE void setText(const QString &text) const;
56  Q_INVOKABLE const QByteArray& stream() const;
57  Q_INVOKABLE void setStream(const QByteArray &stream) const;
58  Q_INVOKABLE const QString& streamType() const;
59  Q_INVOKABLE void setStreamType(const QString &type) const;
60 
61  private:
62  struct Private;
63  QSharedPointer<Private> d;
64 };
65 
66 }
67 }
68 }
69 
70 Q_DECL_EXPORT
71 QDBusArgument &operator<<(QDBusArgument &argument,
72  const com::lomiri::content::Item &item);
73 
74 Q_DECL_EXPORT
75 const QDBusArgument &operator>>(const QDBusArgument &argument,
77 
78 Q_DECLARE_METATYPE(com::lomiri::content::Item)
79 
80 
81 #endif // COM_LOMIRI_CONTENT_ITEM_H_
Q_INVOKABLE const QString text() const
setUrlQString name
Definition: item.h:37
Q_INVOKABLE void setText(const QString &text) const
Item(const QUrl &=QUrl(), QObject *=nullptr)
Q_INVOKABLE const QString & streamType() const
Q_INVOKABLE void setName(const QString &name) const
Item & operator=(const Item &)
Q_INVOKABLE void setUrl(const QUrl &url) const
bool operator==(const Item &) const
Q_INVOKABLE void setStream(const QByteArray &stream) const
Q_INVOKABLE const QString & name() const
Q_INVOKABLE const QUrl & url() const
Q_INVOKABLE const QByteArray & stream() const
Q_INVOKABLE void setStreamType(const QString &type) const
QByteArray stream
Definition: item.h:39
Q_DECL_EXPORT QDBusArgument & operator<<(QDBusArgument &argument, const com::lomiri::content::Item &item)
Q_DECL_EXPORT const QDBusArgument & operator>>(const QDBusArgument &argument, com::lomiri::content::Item &item)
Definition: hub.h:32