Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

QCopEnvelope Class Reference

The QCopEnvelope class encapsulates and sends QCop messages over QCopChannels. More...

#include </home/clem/local/src/opie/library/qcopenvelope_qws.h>

Inheritance diagram for QCopEnvelope:

Inheritance graph
[legend]
Collaboration diagram for QCopEnvelope:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 QCopEnvelope (const QCString &channel, const QCString &message)
 ~QCopEnvelope ()

Private Attributes

QCString ch
QCString msg

Detailed Description

The QCopEnvelope class encapsulates and sends QCop messages over QCopChannels.

QCop messages allow applications to communicate with each other. These messages are sent using QCopEnvelope, and received by connecting to a QCopChannel.

To send a message, use the following protocol:

     QCopEnvelope e(channelname, messagename);
     e << parameter1 << parameter2 << ...;

For messages without parameters, simply use:

     QCopEnvelope e(channelname, messagename);

(Do not try to simplify this further as it may confuse some compilers.)

The {channelname} of channels within Qtopia all start with "QPE/". The {messagename} is a function identifier followed by a list of types in parentheses. There is no whitespace in the message name.

To receive a message, you will generally just use your application's predefined QPE/Application/{appname} channel (see QPEApplication::appMessage()), but you can make another channel and connect it to a slot like this:

      myChannel = new QCopChannel( "QPE/FooBar", this );
      connect( myChannel, SIGNAL(received(const QCString&,const QByteArray&)),
               this, SLOT(fooBarMessage(const QCString&,const QByteArray&)) );

See also, the list of Qtopia messages.

Definition at line 28 of file qcopenvelope_qws.h.


Constructor & Destructor Documentation

QCopEnvelope::QCopEnvelope const QCString channel,
const QCString message
 

Constructs a QCopEnvelope that will write message to channel. If message has parameters, you must then use operator<<() to add these parameters to the envelope.

Definition at line 83 of file qcopenvelope_qws.cpp.

References QDataStream::device(), and IO_WriteOnly.

QCopEnvelope::~QCopEnvelope  ) 
 

Writes the message and then destroys the QCopEnvelope.

Definition at line 93 of file qcopenvelope_qws.cpp.

References ch, QFile::close(), data, QDataStream::device(), QFile::flush(), QFile::handle(), IO_Append, IO_WriteOnly, QCString::mid(), msg, QFile::open(), qstrncmp(), qWarning(), QCopChannel::send(), and stream.


Member Data Documentation

QCString QCopEnvelope::ch [private]
 

Definition at line 29 of file qcopenvelope_qws.h.

Referenced by ~QCopEnvelope().

QCString QCopEnvelope::msg [private]
 

Definition at line 29 of file qcopenvelope_qws.h.

Referenced by ~QCopEnvelope().


The documentation for this class was generated from the following files:
Generated on Sat Nov 5 17:46:25 2005 for OPIE by  doxygen 1.4.2