You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
179 lines
9.2 KiB
179 lines
9.2 KiB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qcopchannel_qws.cpp:55 -->
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>TQCopChannel Class</title>
|
|
<style type="text/css"><!--
|
|
fn { margin-left: 1cm; text-indent: -1cm; }
|
|
a:link { color: #004faf; text-decoration: none }
|
|
a:visited { color: #672967; text-decoration: none }
|
|
body { background: #ffffff; color: black; }
|
|
--></style>
|
|
</head>
|
|
<body>
|
|
|
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|
<tr bgcolor="#E5E5E5">
|
|
<td valign=center>
|
|
<a href="index.html">
|
|
<font color="#004faf">Home</font></a>
|
|
| <a href="classes.html">
|
|
<font color="#004faf">All Classes</font></a>
|
|
| <a href="mainclasses.html">
|
|
<font color="#004faf">Main Classes</font></a>
|
|
| <a href="annotated.html">
|
|
<font color="#004faf">Annotated</font></a>
|
|
| <a href="groups.html">
|
|
<font color="#004faf">Grouped Classes</font></a>
|
|
| <a href="functions.html">
|
|
<font color="#004faf">Functions</font></a>
|
|
</td>
|
|
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQCopChannel Class Reference</h1>
|
|
|
|
<p>The TQCopChannel class provides communication capabilities
|
|
between several clients.
|
|
<a href="#details">More...</a>
|
|
<p><tt>#include <<a href="qcopchannel_qws-h.html">qcopchannel_qws.h</a>></tt>
|
|
<p>Inherits <a href="qobject.html">TQObject</a>.
|
|
<p><a href="qcopchannel-members.html">List of all member functions.</a>
|
|
<h2>Public Members</h2>
|
|
<ul>
|
|
<li class=fn><a href="#TQCopChannel"><b>TQCopChannel</b></a> ( const TQCString & channel, TQObject * parent = 0, const char * name = 0 )</li>
|
|
<li class=fn>virtual <a href="#~TQCopChannel"><b>~TQCopChannel</b></a> ()</li>
|
|
<li class=fn>TQCString <a href="#channel"><b>channel</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#receive"><b>receive</b></a> ( const TQCString & msg, const TQByteArray & data )</li>
|
|
</ul>
|
|
<h2>Signals</h2>
|
|
<ul>
|
|
<li class=fn>void <a href="#received"><b>received</b></a> ( const TQCString & msg, const TQByteArray & data )</li>
|
|
</ul>
|
|
<h2>Static Public Members</h2>
|
|
<ul>
|
|
<li class=fn>bool <a href="#isRegistered"><b>isRegistered</b></a> ( const TQCString & channel )</li>
|
|
<li class=fn>bool <a href="#send-2"><b>send</b></a> ( const TQCString & channel, const TQCString & msg )</li>
|
|
<li class=fn>bool <a href="#send"><b>send</b></a> ( const TQCString & channel, const TQCString & msg, const TQByteArray & data )</li>
|
|
</ul>
|
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
|
|
|
|
|
<p> The TQCopChannel class provides communication capabilities
|
|
between several clients.
|
|
<p> The TQt Cop (TQCOP) is a COmmunication Protocol, allowing clients to
|
|
communicate both within the same address space and between
|
|
different processes.
|
|
<p> Currently, this facility is only available on TQt/Embedded. On X11
|
|
and Windows we are exploring the use of existing standards such as
|
|
DCOP and COM.
|
|
<p> TQCopChannel provides <a href="#send">send</a>() and <a href="#isRegistered">isRegistered</a>() which are static
|
|
functions usable without an object.
|
|
<p> The <a href="#channel">channel</a>() function returns the name of the channel.
|
|
<p> In order to <em>listen</em> to the traffic on a channel, you should
|
|
either subclass TQCopChannel and reimplement <a href="#receive">receive</a>(), or
|
|
<a href="qobject.html#connect">connect</a>() to the <a href="#received">received</a>() signal.
|
|
|
|
<hr><h2>Member Function Documentation</h2>
|
|
<h3 class=fn><a name="TQCopChannel"></a>TQCopChannel::TQCopChannel ( const <a href="qcstring.html">TQCString</a> & channel, <a href="qobject.html">TQObject</a> * parent = 0, const char * name = 0 )
|
|
</h3>
|
|
Constructs a TQCop channel and registers it with the server using
|
|
the name <em>channel</em>. The standard <em>parent</em> and <em>name</em> arguments
|
|
are passed on to the <a href="qobject.html">TQObject</a> constructor.
|
|
|
|
<h3 class=fn><a name="~TQCopChannel"></a>TQCopChannel::~TQCopChannel ()<tt> [virtual]</tt>
|
|
</h3>
|
|
Destroys the client's end of the channel and notifies the server
|
|
that the client has closed its connection. The server will keep
|
|
the channel open until the last registered client detaches.
|
|
|
|
<h3 class=fn><a href="qcstring.html">TQCString</a> <a name="channel"></a>TQCopChannel::channel () const
|
|
</h3>
|
|
Returns the name of the channel.
|
|
|
|
<h3 class=fn>bool <a name="isRegistered"></a>TQCopChannel::isRegistered ( const <a href="qcstring.html">TQCString</a> & channel )<tt> [static]</tt>
|
|
</h3>
|
|
Queries the server for the existence of <em>channel</em>.
|
|
<p> Returns TRUE if <em>channel</em> is registered; otherwise returns FALSE.
|
|
|
|
<h3 class=fn>void <a name="receive"></a>TQCopChannel::receive ( const <a href="qcstring.html">TQCString</a> & msg, const <a href="qbytearray.html">TQByteArray</a> & data )<tt> [virtual]</tt>
|
|
</h3>
|
|
This virtual function allows subclasses of TQCopChannel to process
|
|
data received from their channel.
|
|
<p> The default implementation emits the <a href="#received">received</a>() signal.
|
|
<p> Note that the format of <em>data</em> has to be well defined in order to
|
|
extract the information it contains.
|
|
<p> Example:
|
|
<pre>
|
|
void MyClass::receive( const <a href="qcstring.html">TQCString</a> &msg, const <a href="qbytearray.html">TQByteArray</a> &data )
|
|
{
|
|
<a href="qdatastream.html">TQDataStream</a> stream( data, <a href="qfile.html#open">IO_ReadOnly</a> );
|
|
if ( msg == "execute(TQString,TQString)" ) {
|
|
<a href="qstring.html">TQString</a> cmd, arg;
|
|
stream >> cmd >> arg;
|
|
...
|
|
} else if ( msg == "delete(TQString)" ) {
|
|
<a href="qstring.html">TQString</a> filenname;
|
|
stream >> filename;
|
|
...
|
|
} else ...
|
|
}
|
|
</pre>
|
|
|
|
This example assumes that the <em>msg</em> is a DCOP-style function
|
|
signature and the <em>data</em> contains the function's arguments. (See
|
|
<a href="#send">send</a>().)
|
|
<p> Using the DCOP convention is a recommendation, but not a
|
|
requirement. Whatever convention you use the sender and receiver
|
|
<em>must</em> agree on the argument types.
|
|
<p> <p>See also <a href="#send">send</a>().
|
|
|
|
<h3 class=fn>void <a name="received"></a>TQCopChannel::received ( const <a href="qcstring.html">TQCString</a> & msg, const <a href="qbytearray.html">TQByteArray</a> & data )<tt> [signal]</tt>
|
|
</h3>
|
|
|
|
<p> This signal is emitted with the <em>msg</em> and <em>data</em> whenever the
|
|
<a href="#receive">receive</a>() function gets incoming data.
|
|
|
|
<h3 class=fn>bool <a name="send"></a>TQCopChannel::send ( const <a href="qcstring.html">TQCString</a> & channel, const <a href="qcstring.html">TQCString</a> & msg, const <a href="qbytearray.html">TQByteArray</a> & data )<tt> [static]</tt>
|
|
</h3>
|
|
Send the message <em>msg</em> on channel <em>channel</em> with data <em>data</em>.
|
|
The message will be distributed to all clients subscribed to the
|
|
channel.
|
|
<p> Note that <a href="qdatastream.html">TQDataStream</a> provides a convenient way to fill the byte
|
|
array with auxiliary data.
|
|
<p> Example:
|
|
<pre>
|
|
<a href="qbytearray.html">TQByteArray</a> ba;
|
|
<a href="qdatastream.html">TQDataStream</a> stream( ba, <a href="qfile.html#open">IO_WriteOnly</a> );
|
|
stream << TQString("cat") << TQString("file.txt");
|
|
TQCopChannel::<a href="#send">send</a>( "System/Shell", "execute(TQString,TQString)", ba );
|
|
</pre>
|
|
|
|
Here the channel is "System/Shell". The <em>msg</em> is an arbitrary
|
|
string, but in the example we've used the DCOP convention of
|
|
passing a function signature. Such a signature is formatted as
|
|
functionname(types) where types is a list of zero or more
|
|
comma-separated type names, with no whitespace, no consts and no
|
|
pointer or reference marks, i.e. no "*" or "&".
|
|
<p> Using the DCOP convention is a recommendation, but not a
|
|
requirement. Whatever convention you use the sender and receiver
|
|
<em>must</em> agree on the argument types.
|
|
<p> <p>See also <a href="#receive">receive</a>().
|
|
|
|
<h3 class=fn>bool <a name="send-2"></a>TQCopChannel::send ( const <a href="qcstring.html">TQCString</a> & channel, const <a href="qcstring.html">TQCString</a> & msg )<tt> [static]</tt>
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Send the message <em>msg</em> on channel <em>channel</em>. The message will be
|
|
distributed to all clients subscribed to the <em>channel</em>.
|
|
<p> <p>See also <a href="#receive">receive</a>().
|
|
|
|
<!-- eof -->
|
|
<hr><p>
|
|
This file is part of the <a href="index.html">TQt toolkit</a>.
|
|
Copyright © 1995-2007
|
|
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
|
<table width=100% cellspacing=0 border=0><tr>
|
|
<td>Copyright © 2007
|
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
|
<td align=right><div align=right>TQt 3.3.8</div>
|
|
</table></div></address></body>
|
|
</html>
|