bring Qt3 library back. Some apps that are not in the KDE trunk are using it.
[platform/upstream/dbus.git] / qt3 / message.h
1 /* -*- mode: C++; c-file-style: "gnu" -*- */
2 /* message.h: Qt wrapper for DBusMessage
3  *
4  * Copyright (C) 2003  Zack Rusin <zack@kde.org>
5  *
6  * Licensed under the Academic Free License version 2.1
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  *
22  */
23 #ifndef DBUS_QT_MESSAGE_H
24 #define DBUS_QT_MESSAGE_H
25
26 #include <qvariant.h>
27 #include <qstring.h>
28 #include <qstringlist.h>
29
30 #include "dbus/dbus.h"
31
32 namespace DBusQt {
33
34   class Message
35   {
36   public:
37     class iterator {
38     public:
39       iterator();
40       iterator( const iterator& );
41       iterator( DBusMessage* msg );
42       ~iterator();
43
44       iterator& operator=( const iterator& );
45       const QVariant& operator*() const;
46       QVariant& operator*();
47       iterator& operator++();
48       iterator operator++(int);
49       bool operator==( const iterator& it );
50       bool operator!=( const iterator& it );
51
52       QVariant var() const;
53     protected:
54       QVariant marshallBaseType( DBusMessageIter* i );
55       void fillVar();
56       struct IteratorData;
57       IteratorData *d;
58     };
59
60     Message( int messageType );
61     Message( DBusMessage * );//hide this one from the public implementation
62     Message( const QString& service, const QString& path,
63              const QString& interface, const QString& method );
64     Message( const Message& replayingTo );
65     Message( const QString& path, const QString& interface,
66              const QString& name );
67     Message( const Message& replayingTo, const QString& errorName,
68              const QString& errorMessage );
69
70     Message operator=( const Message& other );
71
72     virtual ~Message();
73
74     int type() const;
75
76     void setPath( const QString& );
77     QString path() const;
78
79     void setInterface( const QString& );
80     QString interface() const;
81
82     void setMember( const QString& );
83     QString member() const;
84
85     void setErrorName( const QString& );
86     QString errorName() const;
87
88     void setDestination( const QString& );
89     QString destination() const;
90
91     bool    setSender( const QString& sender );
92     QString    sender() const;
93
94     QString signature() const;
95
96     iterator begin() const;
97     iterator end() const;
98
99     QVariant at( int i );
100
101
102   public:
103     Message& operator<<( bool );
104     Message& operator<<( Q_INT8 );
105     Message& operator<<( Q_INT32 );
106     Message& operator<<( Q_UINT32 );
107     Message& operator<<( Q_INT64 );
108     Message& operator<<( Q_UINT64 );
109     Message& operator<<( double );
110     Message& operator<<( const QString& );
111     Message& operator<<( const QVariant& );
112     //Message& operator<<();
113     //Message& operator<<();
114     //Message& operator<<();
115     //Message& operator<<();
116     //Message& operator<<();
117     //Message& operator<<();
118     //Message& operator<<();
119
120   protected:
121     friend class Connection;
122     DBusMessage* message() const;
123
124   private:
125     struct Private;
126     Private *d;
127   };
128
129 }
130
131 #endif