Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > main-release > by-pkgid > ea24284f03fd4a8a4b64047514d93f64 > files > 334

lib64kdegames1-devel-3.5.9-2mdv2008.1.x86_64.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en_US" xml:lang="en_US">

<head>
  <title>libkdegames: kmessageclient.h Source File (libkdegames)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  <meta http-equiv="Content-Style-Type" content="text/css" />

  <meta http-equiv="pics-label" content='(pics-1.1 "http://www.icra.org/ratingsv02.html" comment "ICRAonline DE v2.0" l gen true for "http://www.kde.org"  r (nz 1 vz 1 lz 1 oz 1 cb 1) "http://www.rsac.org/ratingsv01.html" l gen true for "http://www.kde.org"  r (n 0 s 0 v 0 l 0))' />

  <meta name="trademark" content="KDE e.V." />
  <meta name="description" content="K Desktop Environment Homepage, KDE.org" />
  <meta name="MSSmartTagsPreventParsing" content="true" />
  <meta name="robots" content="all" />

  <link rel="shortcut icon" href="../../favicon.ico" />

<link rel="stylesheet" media="screen" type="text/css" title="APIDOX" href="doxygen.css" />



</head>

<body>

<div id="nav_header_top" align="right">
  <a href="#content" class="doNotDisplay" accesskey="2">Skip to main content ::</a>

  <a href="../.."><img id="nav_header_logo" alt="Home" align="left" src="../../kde_gear_64.png" border="0" /></a>
  <span class="doNotDisplay">::</span>

  <div id="nav_header_title" align="left">KDE API Reference</div>


</div>

<div id="nav_header_bottom" align="right">
  <span class="doNotDisplay">:: <a href="#navigation" accesskey="5">Skip to Link Menu</a><br/></span>
  <div id="nav_header_bottom_right" style="text-align: left;">
/ <a href="../..">API Reference</a>
 / <a href=".">libkdegames</a>
  </div>
</div>


<table id="main" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
      <td valign="top" class="menuheader" height="0"></td>

  <td id="contentcolumn" valign="top" rowspan="2" >
    <div id="content" style="padding-top: 0px;"><div style="width:100%; margin: 0px; padding: 0px;">
    <a name="content"></a>


<!-- Generated by Doxygen 1.5.5 -->
<h1>kmessageclient.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">    This file is part of the KDE games library</span>
<a name="l00003"></a>00003 <span class="comment">    Copyright (C) 2001 Burkhard Lehner (Burkhard.Lehner@gmx.de)</span>
<a name="l00004"></a>00004 <span class="comment"></span>
<a name="l00005"></a>00005 <span class="comment">    This library is free software; you can redistribute it and/or</span>
<a name="l00006"></a>00006 <span class="comment">    modify it under the terms of the GNU Library General Public</span>
<a name="l00007"></a>00007 <span class="comment">    License version 2 as published by the Free Software Foundation.</span>
<a name="l00008"></a>00008 <span class="comment"></span>
<a name="l00009"></a>00009 <span class="comment">    This library is distributed in the hope that it will be useful,</span>
<a name="l00010"></a>00010 <span class="comment">    but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00011"></a>00011 <span class="comment">    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
<a name="l00012"></a>00012 <span class="comment">    Library General Public License for more details.</span>
<a name="l00013"></a>00013 <span class="comment"></span>
<a name="l00014"></a>00014 <span class="comment">    You should have received a copy of the GNU Library General Public License</span>
<a name="l00015"></a>00015 <span class="comment">    along with this library; see the file COPYING.LIB.  If not, write to</span>
<a name="l00016"></a>00016 <span class="comment">    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,</span>
<a name="l00017"></a>00017 <span class="comment">    Boston, MA 02110-1301, USA.</span>
<a name="l00018"></a>00018 <span class="comment">*/</span>
<a name="l00019"></a>00019 
<a name="l00020"></a>00020 <span class="preprocessor">#ifndef __KMESSAGECLIENT_H__</span>
<a name="l00021"></a>00021 <span class="preprocessor"></span><span class="preprocessor">#define __KMESSAGECLIENT_H__</span>
<a name="l00022"></a>00022 <span class="preprocessor"></span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &lt;qobject.h&gt;</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &lt;qstring.h&gt;</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;qvaluelist.h&gt;</span>
<a name="l00026"></a>00026 
<a name="l00027"></a>00027 <span class="keyword">class </span><a class="code" href="classKMessageIO.html" title="This abstract base class represents one end of a message connections between two...">KMessageIO</a>;
<a name="l00028"></a>00028 <span class="keyword">class </span><a class="code" href="classKMessageServer.html" title="A server for message sending and broadcasting, using TCP/IP connections.">KMessageServer</a>;
<a name="l00029"></a>00029 <span class="keyword">class </span>KMessageClientPrivate;
<a name="l00030"></a>00030 
<a name="l00050"></a><a class="code" href="classKMessageClient.html">00050</a> <span class="keyword">class </span><a class="code" href="classKMessageClient.html" title="A client to connect to a KMessageServer.">KMessageClient</a> : <span class="keyword">public</span> QObject
<a name="l00051"></a>00051 {
<a name="l00052"></a>00052   Q_OBJECT
<a name="l00053"></a>00053 
<a name="l00054"></a>00054 <span class="keyword">public</span>:
<a name="l00055"></a>00055 
<a name="l00061"></a>00061   <a class="code" href="classKMessageClient.html#8a403dc979b7e4477ef13f374a2787bf" title="Constructor.">KMessageClient</a> (QObject *parent = 0, <span class="keyword">const</span> <span class="keywordtype">char</span> *name = 0);
<a name="l00062"></a>00062 
<a name="l00067"></a>00067   <a class="code" href="classKMessageClient.html#3fd81e8c1ebc4ce8e970dd245b6c8d80" title="Destructor.">~KMessageClient</a> ();
<a name="l00068"></a>00068 
<a name="l00076"></a>00076   Q_UINT32 <a class="code" href="classKMessageClient.html#d9dd0f423264520ee541ebe9030ab5b1">id</a> () <span class="keyword">const</span>;
<a name="l00077"></a>00077 
<a name="l00088"></a>00088   <span class="keywordtype">bool</span> <a class="code" href="classKMessageClient.html#bf578ea37eba2432910913605336f810">isAdmin</a> () <span class="keyword">const</span>;
<a name="l00089"></a>00089 
<a name="l00093"></a>00093   Q_UINT32 <a class="code" href="classKMessageClient.html#71388787b38bb67fea7377338135bc47">adminId</a>() <span class="keyword">const</span>;
<a name="l00094"></a>00094 
<a name="l00098"></a>00098   <span class="keyword">const</span> QValueList &lt;Q_UINT32&gt; &amp;<a class="code" href="classKMessageClient.html#28619a81efb0f499468812b733e096a8">clientList</a>() <span class="keyword">const</span>;
<a name="l00099"></a>00099 
<a name="l00111"></a>00111   <span class="keywordtype">void</span> <a class="code" href="classKMessageClient.html#2d4d20d4fdd41c90675171722bd05502" title="Connects the client to (another) server.">setServer</a> (<span class="keyword">const</span> QString &amp;host, Q_UINT16 port);
<a name="l00112"></a>00112 
<a name="l00122"></a>00122   <span class="keywordtype">void</span> <a class="code" href="classKMessageClient.html#2d4d20d4fdd41c90675171722bd05502" title="Connects the client to (another) server.">setServer</a> (<a class="code" href="classKMessageServer.html" title="A server for message sending and broadcasting, using TCP/IP connections.">KMessageServer</a> *server);
<a name="l00123"></a>00123 
<a name="l00127"></a>00127   <span class="keywordtype">void</span> <a class="code" href="classKMessageClient.html#823aed246d413cf726eda011809f511f" title="Corresponds to setServer(0); but also emits the connectionBroken signal.">disconnect</a>();
<a name="l00128"></a>00128 
<a name="l00150"></a>00150   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classKMessageClient.html#2d4d20d4fdd41c90675171722bd05502" title="Connects the client to (another) server.">setServer</a> (<a class="code" href="classKMessageIO.html" title="This abstract base class represents one end of a message connections between two...">KMessageIO</a> *connection);
<a name="l00151"></a>00151 
<a name="l00158"></a>00158   <span class="keywordtype">bool</span> <a class="code" href="classKMessageClient.html#2b1babd61361bbdcbc587ea900ee9f2a">isConnected</a> () <span class="keyword">const</span>;
<a name="l00159"></a>00159 
<a name="l00164"></a>00164   <span class="keywordtype">bool</span> <a class="code" href="classKMessageClient.html#86de3acda877251bceec5c74ff5dcdd5">isNetwork</a> () <span class="keyword">const</span>;
<a name="l00165"></a>00165 
<a name="l00171"></a>00171   Q_UINT16 <a class="code" href="classKMessageClient.html#66319e74b115b33e631e5b80c57bc120">peerPort</a> () <span class="keyword">const</span>;
<a name="l00172"></a>00172 
<a name="l00178"></a>00178   QString <a class="code" href="classKMessageClient.html#c9a107e43dfdaf0bb85e0f5781283211">peerName</a>() <span class="keyword">const</span>;
<a name="l00179"></a>00179 
<a name="l00191"></a>00191   <span class="keywordtype">void</span> <a class="code" href="classKMessageClient.html#b56563cb58b75c83287f90ad4b4c8901" title="Sends a message to the KMessageServer.">sendServerMessage</a> (<span class="keyword">const</span> QByteArray &amp;msg);
<a name="l00192"></a>00192 
<a name="l00201"></a>00201   <span class="comment">//AB: processBroadcast doesn't exist!! is processIncomingMessage meant?</span>
<a name="l00202"></a>00202   <span class="keywordtype">void</span> <a class="code" href="classKMessageClient.html#578aea2a02fc0cd7da0435ee61bed189" title="Sends a message to all the clients connected to the server, including ourself.">sendBroadcast</a> (<span class="keyword">const</span> QByteArray &amp;msg);
<a name="l00203"></a>00203 
<a name="l00220"></a>00220   <span class="comment">//AB: processForward doesn't exist!! is processIncomingMessage meant?</span>
<a name="l00221"></a>00221   <span class="keywordtype">void</span> <a class="code" href="classKMessageClient.html#4c746603d3f92cb6bf454684db5075ed" title="Sends a message to all the clients in a list.">sendForward</a> (<span class="keyword">const</span> QByteArray &amp;msg, <span class="keyword">const</span> QValueList &lt;Q_UINT32&gt; &amp;clients);
<a name="l00222"></a>00222 
<a name="l00233"></a>00233   <span class="keywordtype">void</span> <a class="code" href="classKMessageClient.html#4c746603d3f92cb6bf454684db5075ed" title="Sends a message to all the clients in a list.">sendForward</a> (<span class="keyword">const</span> QByteArray &amp;msg, Q_UINT32 client);
<a name="l00234"></a>00234 
<a name="l00242"></a>00242   <span class="keywordtype">void</span> <a class="code" href="classKMessageClient.html#2e36bd5e629d414f1b6b990329c8facd" title="Once this function is called no message will be received anymore.">lock</a>();
<a name="l00243"></a>00243 
<a name="l00248"></a>00248   <span class="keywordtype">void</span> <a class="code" href="classKMessageClient.html#c2e273a837eb798c97588b2554b0f7b5" title="Deliver every message that was delayed by lock() and actually deliver all messages...">unlock</a>();
<a name="l00249"></a>00249 
<a name="l00253"></a>00253   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classKMessageClient.html#6f9f91cbf9d7871dbf11ca6417bd8113">delayedMessageCount</a>() <span class="keyword">const</span>;
<a name="l00254"></a>00254 
<a name="l00255"></a>00255 signals:
<a name="l00276"></a>00276   <span class="keywordtype">void</span> <a class="code" href="classKMessageClient.html#a7326267044d1fced519eb6692401ffd" title="This signal is emitted when the client receives a broadcast message from the KMessageServer...">broadcastReceived</a> (<span class="keyword">const</span> QByteArray &amp;msg, Q_UINT32 senderID);
<a name="l00277"></a>00277 
<a name="l00306"></a>00306   <span class="keywordtype">void</span> <a class="code" href="classKMessageClient.html#73572635b3fe84e5394473f63a6dd484" title="This signal is emitted when the client receives a forward message from the KMessageServer...">forwardReceived</a> (<span class="keyword">const</span> QByteArray &amp;msg, Q_UINT32 senderID, <span class="keyword">const</span> QValueList &lt;Q_UINT32&gt; &amp;receivers);
<a name="l00307"></a>00307 
<a name="l00317"></a>00317   <span class="keywordtype">void</span> <a class="code" href="classKMessageClient.html#8d1f72bab042b3ab624772dab81ea79d" title="This signal is emitted when the connection to the KMessageServer is broken.">connectionBroken</a> ();
<a name="l00318"></a>00318 
<a name="l00323"></a>00323   <span class="keywordtype">void</span> <a class="code" href="classKMessageClient.html#3b2c9bc7b058e0c9869161e3428f4fca" title="This signal is emitted right before the client disconnects.">aboutToDisconnect</a>(Q_UINT32 <span class="keywordtype">id</span>);
<a name="l00324"></a>00324 
<a name="l00331"></a>00331   <span class="keywordtype">void</span> <a class="code" href="classKMessageClient.html#a27a8d5cc9ebda4982d16f57f362fa59" title="This signal is emitted when this client becomes the admin client or when it loses...">adminStatusChanged</a> (<span class="keywordtype">bool</span> isAdmin);
<a name="l00332"></a>00332 
<a name="l00339"></a>00339   <span class="keywordtype">void</span> <a class="code" href="classKMessageClient.html#a58d23aa1465c99b71e8d6038dd54c9b" title="This signal is emitted when another client has connected to the server.">eventClientConnected</a> (Q_UINT32 clientID);
<a name="l00340"></a>00340 
<a name="l00348"></a>00348   <span class="keywordtype">void</span> <a class="code" href="classKMessageClient.html#225bf4124b2897c8ca3f1add784aee8d" title="This signal is emitted when the server has lost the connection to one of the clients...">eventClientDisconnected</a> (Q_UINT32 clientID, <span class="keywordtype">bool</span> broken);
<a name="l00349"></a>00349 
<a name="l00360"></a>00360   <span class="comment">//AB: maybe add a setNoEmit() so that the other signals can be deactivated?</span>
<a name="l00361"></a>00361   <span class="comment">//Could be a performance benefit (note: KMessageClient is a time critical</span>
<a name="l00362"></a>00362   <span class="comment">//class!!!)</span>
<a name="l00363"></a>00363   <span class="keywordtype">void</span> <a class="code" href="classKMessageClient.html#9c2d88f0b951977717c65f9727db1882" title="This signal is emitted on every message that came from the server.">serverMessageReceived</a> (<span class="keyword">const</span> QByteArray &amp;msg, <span class="keywordtype">bool</span> &amp;unknown);
<a name="l00364"></a>00364 
<a name="l00365"></a>00365 <span class="keyword">protected</span>:
<a name="l00383"></a>00383   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classKMessageClient.html#0e05f0019ca90b8f80b865d61d58416f" title="This slot is called from processIncomingMessage or processFirstMessage, depending...">processMessage</a> (<span class="keyword">const</span> QByteArray&amp; msg);
<a name="l00384"></a>00384 
<a name="l00385"></a>00385 <span class="keyword">protected</span> slots:
<a name="l00401"></a>00401   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classKMessageClient.html#7cb58c18e7687f9428a07672125c2e30" title="This slot is called from the signal KMessageIO::received whenever a message from...">processIncomingMessage</a> (<span class="keyword">const</span> QByteArray &amp;msg);
<a name="l00402"></a>00402 
<a name="l00407"></a>00407   <span class="keywordtype">void</span> <a class="code" href="classKMessageClient.html#0c462b9f59de94255e7fbf24432c0343" title="Called from unlock() (using QTimer::singleShot) until all delayed messages are delivered...">processFirstMessage</a>();
<a name="l00408"></a>00408 
<a name="l00415"></a>00415   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classKMessageClient.html#d6f9779381285ee41492f4e026758e26" title="This slot is called from the signal KMessageIO::connectionBroken.">removeBrokenConnection</a> ();
<a name="l00416"></a>00416   <span class="keywordtype">void</span> removeBrokenConnection2 ();
<a name="l00417"></a>00417 
<a name="l00418"></a>00418 <span class="keyword">private</span>:
<a name="l00419"></a>00419   KMessageClientPrivate *d;
<a name="l00420"></a>00420 };
<a name="l00421"></a>00421 
<a name="l00422"></a>00422 <span class="preprocessor">#endif</span>
</pre></div></div>
    </div></div>


      </td>
  </tr>
  <tr>
    <td valign="top" id="leftmenu" width="25%">
      <a name="navigation"></a>
      <div class="menu_box"><h2>libkdegames</h2>
<div class="nav_list">
<ul><li><a href="index.html">Main Page</a></li><li><a href="hierarchy.html">Class Hierarchy</a></li><li><a href="classes.html">Alphabetical List</a></li><li><a href="annotated.html">Class List</a></li><li><a href="files.html">File List</a></li><li><a href="functions.html">Class Members</a></li><li><a href="pages.html">Related Pages</a></li></ul>
<!--
<h2>Class Picker</h2>
<div style="text-align: center;">
<form name="guideform">
<select name="guidelinks" style="width:100%;" onChange="window.location=document.guideform.guidelinks.options[document.guideform.guidelinks.selectedIndex].value">
<option value="annotated.html">-- Choose --</option>
  <option value="classKCanvasRootPixmap.html">kcanvasrootpixmap</option>,  <option value="classKCardDialog.html">kcarddialog</option>,  <option value="classKChat.html">kchat</option>,  <option value="classKChatBase.html">kchatbase</option>,  <option value="classKChatBaseText.html">kchatbasetext</option>,  <option value="classKExtHighscore_1_1Item.html">kexthighscore::item</option>,  <option value="classKExtHighscore_1_1ItemArray.html">kexthighscore::itemarray</option>,  <option value="classKExtHighscore_1_1Manager.html">kexthighscore::manager</option>,  <option value="classKExtHighscore_1_1MultiplayerScores.html">kexthighscore::multiplayerscores</option>,  <option value="classKExtHighscore_1_1Score.html">kexthighscore::score</option>,  <option value="classKGame.html">kgame</option>,  <option value="classKGameChat.html">kgamechat</option>,  <option value="classKGameComputerIO.html">kgamecomputerio</option>,  <option value="classKGameConnectDialog.html">kgameconnectdialog</option>,  <option value="classKGameDialog.html">kgamedialog</option>,  <option value="classKGameDialogChatConfig.html">kgamedialogchatconfig</option>,  <option value="classKGameDialogConfig.html">kgamedialogconfig</option>,  <option value="classKGameErrorDialog.html">kgameerrordialog</option>,  <option value="classKGameErrorMessageDialog.html">kgameerrormessagedialog</option>,  <option value="classKGameIO.html">kgameio</option>,  <option value="classKGameKeyIO.html">kgamekeyio</option>,  <option value="classKGameLCD.html">kgamelcd</option>,  <option value="classKGameLCDClock.html">kgamelcdclock</option>,  <option value="classKGameLCDList.html">kgamelcdlist</option>,  <option value="classKGameMisc.html">kgamemisc</option>,  <option value="classKGameMouseIO.html">kgamemouseio</option>,  <option value="classKGameNetwork.html">kgamenetwork</option>,  <option value="classKGameProcess.html">kgameprocess</option>,  <option value="classKGameProcessIO.html">kgameprocessio</option>,  <option value="classKGameProgress.html">kgameprogress</option>,  <option value="classKGameProperty.html">kgameproperty</option>,  <option value="classKGamePropertyBase.html">kgamepropertybase</option>,  <option value="classKGamePropertyHandler.html">kgamepropertyhandler</option>,  <option value="classKGameSequence.html">kgamesequence</option>,  <option value="classKGrid2D_1_1Generic.html">kgrid2d::generic</option>,  <option value="classKGrid2D_1_1Hexagonal.html">kgrid2d::hexagonal</option>,  <option value="classKGrid2D_1_1HexagonalBase.html">kgrid2d::hexagonalbase</option>,  <option value="classKGrid2D_1_1Square.html">kgrid2d::square</option>,  <option value="classKGrid2D_1_1SquareBase.html">kgrid2d::squarebase</option>,  <option value="classKHighscore.html">khighscore</option>,  <option value="classKMessageClient.html">kmessageclient</option>,  <option value="classKMessageDirect.html">kmessagedirect</option>,  <option value="classKMessageIO.html">kmessageio</option>,  <option value="classKMessageServer.html">kmessageserver</option>,  <option value="classKMessageServerSocket.html">kmessageserversocket</option>,  <option value="classKMessageSocket.html">kmessagesocket</option>,  <option value="classKPlayer.html">kplayer</option>,  <option value="classKScoreDialog.html">kscoredialog</option>,  <option value="classKStdGameAction.html">kstdgameaction</option>,
</select>
</form>
</div>
-->
</div></div>
<div class="menu_box"><h2>API Dox</h2>
<div class="nav_list">
<ul>
<li><a href="../../libkdegames/html/index.html">libkdegames</a></li>
</ul></div></div>


        </td>
</tr>
</table>

<span class="doNotDisplay">
  <a href="http://www.kde.org/" accesskey="8">KDE Home</a> |
  <a href="http://accessibility.kde.org/" accesskey="9">KDE Accessibility Home</a> |
  <a href="http://www.kde.org/media/accesskeys.php" accesskey="0">Description of Access Keys</a>
</span>


<div style="height: 8px"></div>

<div id="footer">
  <div id="footer_left">
    Maintained by <a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;groo&#116;&#64;kde&#46;or&#x67;">Adriaan de Groot</a>
and
<a href="&#109;a&#105;&#108;&#116;&#111;&#58;w&#105;nter&#64;kde&#46;or&#x67">Allen Winter</a>.
<br/>
    KDE and K Desktop Environment are trademarks of <a href="http://www.kde.org/areas/kde-ev/" title="Homepage of the KDE non-profit Organization">KDE e.V.</a> |
    <a href="http://www.kde.org/contact/impressum.php">Legal</a>
  </div>
  <div id="footer_right"><img src="/media/images/footer_right.png" style="margin: 0px" alt="" /></div>
</div>

<!--
WARNING: DO NOT SEND MAIL TO THE FOLLOWING EMAIL ADDRESS! YOU WILL
BE BLOCKED INSTANTLY AND PERMANENTLY!
<a href="mailto:aaaatrap-425acc3b5374943f@kde.org">Block me</a>
WARNING END
-->

</body>
</html>