00001 /* -*- mode: C++; c-file-style: "gnu" -*- */ 00002 /* message.h: Qt wrapper for DBusMessage 00003 * 00004 * Copyright (C) 2003 Zack Rusin <zack@kde.org> 00005 * 00006 * Licensed under the Academic Free License version 2.1 00007 * 00008 * This program is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00021 * 00022 */ 00023 #ifndef DBUS_QT_MESSAGE_H 00024 #define DBUS_QT_MESSAGE_H 00025 00026 #include <qvariant.h> 00027 #include <qstring.h> 00028 #include <qstringlist.h> 00029 00030 #include "dbus/dbus.h" 00031 00032 namespace DBusQt { 00033 00034 class Message 00035 { 00036 public: 00037 class iterator { 00038 public: 00039 iterator(); 00040 iterator( const iterator& ); 00041 iterator( DBusMessage* msg ); 00042 ~iterator(); 00043 00044 iterator& operator=( const iterator& ); 00045 const QVariant& operator*() const; 00046 QVariant& operator*(); 00047 iterator& operator++(); 00048 iterator operator++(int); 00049 bool operator==( const iterator& it ); 00050 bool operator!=( const iterator& it ); 00051 00052 QVariant var() const; 00053 protected: 00054 QVariant marshallBaseType( DBusMessageIter* i ); 00055 void fillVar(); 00056 struct IteratorData; 00057 IteratorData *d; 00058 }; 00059 00060 Message( int messageType ); 00061 Message( DBusMessage * );//hide this one from the public implementation 00062 Message( const QString& service, const QString& path, 00063 const QString& interface, const QString& method ); 00064 Message( const Message& replayingTo ); 00065 Message( const QString& path, const QString& interface, 00066 const QString& name ); 00067 Message( const Message& replayingTo, const QString& errorName, 00068 const QString& errorMessage ); 00069 00070 Message operator=( const Message& other ); 00071 00072 virtual ~Message(); 00073 00074 int type() const; 00075 00076 void setPath( const QString& ); 00077 QString path() const; 00078 00079 void setInterface( const QString& ); 00080 QString interface() const; 00081 00082 void setMember( const QString& ); 00083 QString member() const; 00084 00085 void setErrorName( const QString& ); 00086 QString errorName() const; 00087 00088 void setDestination( const QString& ); 00089 QString destination() const; 00090 00091 bool setSender( const QString& sender ); 00092 QString sender() const; 00093 00094 QString signature() const; 00095 00096 iterator begin() const; 00097 iterator end() const; 00098 00099 QVariant at( int i ); 00100 00101 00102 public: 00103 Message& operator<<( bool ); 00104 Message& operator<<( Q_INT8 ); 00105 Message& operator<<( Q_INT32 ); 00106 Message& operator<<( Q_UINT32 ); 00107 Message& operator<<( Q_INT64 ); 00108 Message& operator<<( Q_UINT64 ); 00109 Message& operator<<( double ); 00110 Message& operator<<( const QString& ); 00111 Message& operator<<( const QVariant& ); 00112 //Message& operator<<(); 00113 //Message& operator<<(); 00114 //Message& operator<<(); 00115 //Message& operator<<(); 00116 //Message& operator<<(); 00117 //Message& operator<<(); 00118 //Message& operator<<(); 00119 00120 protected: 00121 friend class Connection; 00122 DBusMessage* message() const; 00123 00124 private: 00125 struct Private; 00126 Private *d; 00127 }; 00128 00129 } 00130 00131 #endif