/usr/include/kggzmod/event.h is in libkdegames-dev 4:4.8.2-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | /*
This file is part of the kggzmod library.
Copyright (c) 2005 - 2007 Josef Spillner <josef@ggzgamingzone.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KGGZMOD_EVENT_H
#define KGGZMOD_EVENT_H
#include <QtCore/QMap>
#include <QtCore/QString>
#include "kggzmod_export.h"
namespace KGGZMod
{
class Player;
/**
* @short Events from the GGZ core client.
*
* When there is some important information from the GGZ core client
* to the game client, an event is submitted in \ref Module::signalEvent.
* In most cases the event is originating from the GGZ server.
*
* Depending on the type of the event, the more general \ref Event object
* can be casted to specific objects of type \ref LaunchEvent, \ref ServerEvent,
* \ref SelfEvent, \ref SeatEvent, \ref ChatEvent, \ref StatsEvent and
* \ref InfoEvent. However, this is not strictly needed, as all data
* is available from the public \ref data hashtable, should a game
* wish to use this instead.
*
* None of the events must be handled by the game client, especially when
* using the \b KGGZSeatsDialog class for player management.
* However, it is often convenient to catch the \ref ServerEvent to get
* the file descriptor which refers to the connection to the game server.
*
* @author Josef Spillner (josef@ggzgamingzone.org)
*/
class KGGZMOD_EXPORT Event
{
friend class ModulePrivate;
public:
/**
* The type of the event. Depending on this type,
* the object might be casted to a more specific
* class.
*/
enum Type
{
launch, /**< Game was launched. */
server, /**< Connected to server. */
self, /**< Your seat was assigned. */
seat, /**< Someone's seat changed. */
chat, /**< A chat message was received */
stats, /**< Statistics have been received for a player. */
info, /**< Information about a player has arrived. */
rankings /**< Experimental: Rankings information for this game/room */
};
/**
* Creates an event of a specific type.
*
* The event will not be valid until all \ref data fields
* are properly filled out. Therefore, only the \ref Module
* is supposed to create event objects.
*
* @param type Type of the event
*
* @internal
*/
Event(Type type);
/**
* Returns the type of an event.
*
* @return type of an event
*/
Type type() const;
/**
* Returns the pointer to the player associated with the event.
*
* If no player is associated, this returns \b null.
*
* @return player associated with an event
*/
Player *player() const;
/**
* Data storage for all events.
*
* Independent of the actual type of the event,
* all important data is stored in this map.
*/
QMap<QString, QString> data;
protected:
Player *m_player;
private:
Type m_type;
};
/**
* @short Launch event from the GGZ core client.
*
* An event of this type describes that a game server has just
* been launched. This is the first event a game client ever gets.
*
* Refer to the \ref Event documentation for everything else.
*
* @author Josef Spillner (josef@ggzgamingzone.org)
*/
class LaunchEvent : public Event
{
public:
LaunchEvent(const Event& event);
};
/**
* @short Server event from the GGZ core client.
*
* An event of this type describes that the game client is connected
* to the game server. The file descriptor can be retrieved through
* the \ref fd method.
*
* Refer to the \ref Event documentation for everything else.
*
* @author Josef Spillner (josef@ggzgamingzone.org)
*/
class KGGZMOD_EXPORT ServerEvent : public Event
{
public:
ServerEvent(const Event& event);
int fd() const;
};
/**
* @short Event about oneself from the GGZ core client.
*
* This event occurs once and informs the game client about its own
* position in the game. The \ref self method returns the
* player object which the game client is linked to.
*
* Refer to the \ref Event documentation for everything else.
*
* @author Josef Spillner (josef@ggzgamingzone.org)
*/
class SelfEvent : public Event
{
public:
SelfEvent(const Event& event);
Player *self() const;
};
/**
* @short Event about seat changes from the GGZ core client.
*
* Whenever a seat assignment changes, the list of players is
* updated and information about the new assignment is available
* through this event's \ref player method.
*
* Refer to the \ref Event documentation for everything else.
*
* @author Josef Spillner (josef@ggzgamingzone.org)
*/
class SeatEvent : public Event
{
public:
SeatEvent(const Event& event);
Player *player() const;
};
/**
* @short Chat event from the GGZ core client.
*
* Chat messages from a player to others on the same table are
* displayed as table chat in GGZ core clients, but are also
* delivered to the game clients.
*
* Refer to the \ref Event documentation for everything else.
*
* @author Josef Spillner (josef@ggzgamingzone.org)
*/
class ChatEvent : public Event
{
public:
ChatEvent(const Event& event);
Player *player() const;
QString message() const;
};
/**
* @short Statistics from the GGZ core client.
*
* After the table configuration is known, that is, after all
* seats have been assigned, for both the player seats and
* the spectator seats statistics are received. The \ref
* Statistics are available through the returned \ref player
* objects.
*
* Refer to the \ref Event documentation for everything else.
*
* @author Josef Spillner (josef@ggzgamingzone.org)
*/
class StatsEvent : public Event
{
public:
StatsEvent(const Event& event);
Player *player() const;
};
/**
* @short Player information from the GGZ core client.
*
* Extended player information, if requested with a
* \ref InfoRequest, has arrived when an event of this
* type occurs.
*
* Refer to the \ref Event documentation for everything else.
*
* @author Josef Spillner (josef@ggzgamingzone.org)
*/
class InfoEvent : public Event
{
public:
InfoEvent(const Event& event);
Player *player() const;
};
/**
* @short Rankings information for this game/room.
*
* After a game has been played, the statistics usually
* change regarding player placements, highscores, ratings
* and wins/losses. This event can be requested during the
* game to report on the current statistics, and it will
* arrive automatically at the end of the game to report
* on the new one.
*
* Refer to the \ref Event documentation for everything else.
*
* @author Josef Spillner (josef@ggzgamingzone.org)
*/
class KGGZMOD_EXPORT RankingsEvent : public Event
{
public:
RankingsEvent(const Event& event);
int count() const;
QString name(int i) const;
int score(int i) const;
};
}
#endif
|