mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-12 00:54:53 -07:00
Clang-format (#3028)
* 1/3 Add .clang-format file and travis compilation check * 2/3 Run clang-format * 3/3 Fix compilation problems due to include reordering * 3bis/3 AfterControlStatement: false
This commit is contained in:
parent
8dbdd24c8e
commit
b29bd9e070
272 changed files with 13378 additions and 9535 deletions
|
|
@ -1,63 +1,119 @@
|
|||
#ifndef SERVER_RESPONSE_CONTAINERS_H
|
||||
#define SERVER_RESPONSE_CONTAINERS_H
|
||||
|
||||
#include <QPair>
|
||||
#include <QList>
|
||||
#include "pb/server_message.pb.h"
|
||||
#include <QList>
|
||||
#include <QPair>
|
||||
|
||||
namespace google { namespace protobuf { class Message; } }
|
||||
namespace google
|
||||
{
|
||||
namespace protobuf
|
||||
{
|
||||
class Message;
|
||||
}
|
||||
} // namespace google
|
||||
class Server_Game;
|
||||
|
||||
class GameEventStorageItem {
|
||||
class GameEventStorageItem
|
||||
{
|
||||
public:
|
||||
enum EventRecipient { SendToPrivate = 0x01, SendToOthers = 0x02};
|
||||
enum EventRecipient
|
||||
{
|
||||
SendToPrivate = 0x01,
|
||||
SendToOthers = 0x02
|
||||
};
|
||||
Q_DECLARE_FLAGS(EventRecipients, EventRecipient)
|
||||
private:
|
||||
GameEvent *event;
|
||||
EventRecipients recipients;
|
||||
|
||||
public:
|
||||
GameEventStorageItem(const ::google::protobuf::Message &_event, int _playerId, EventRecipients _recipients);
|
||||
~GameEventStorageItem();
|
||||
|
||||
const GameEvent &getGameEvent() const { return *event; }
|
||||
EventRecipients getRecipients() const { return recipients; }
|
||||
|
||||
const GameEvent &getGameEvent() const
|
||||
{
|
||||
return *event;
|
||||
}
|
||||
EventRecipients getRecipients() const
|
||||
{
|
||||
return recipients;
|
||||
}
|
||||
};
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(GameEventStorageItem::EventRecipients)
|
||||
|
||||
class GameEventStorage {
|
||||
class GameEventStorage
|
||||
{
|
||||
private:
|
||||
::google::protobuf::Message *gameEventContext;
|
||||
QList<GameEventStorageItem *> gameEventList;
|
||||
int privatePlayerId;
|
||||
|
||||
public:
|
||||
GameEventStorage();
|
||||
~GameEventStorage();
|
||||
|
||||
|
||||
void setGameEventContext(const ::google::protobuf::Message &_gameEventContext);
|
||||
::google::protobuf::Message *getGameEventContext() const { return gameEventContext; }
|
||||
const QList<GameEventStorageItem *> &getGameEventList() const { return gameEventList; }
|
||||
int getPrivatePlayerId() const { return privatePlayerId; }
|
||||
|
||||
void enqueueGameEvent(const ::google::protobuf::Message &event, int playerId, GameEventStorageItem::EventRecipients recipients = GameEventStorageItem::SendToPrivate | GameEventStorageItem::SendToOthers, int _privatePlayerId = -1);
|
||||
::google::protobuf::Message *getGameEventContext() const
|
||||
{
|
||||
return gameEventContext;
|
||||
}
|
||||
const QList<GameEventStorageItem *> &getGameEventList() const
|
||||
{
|
||||
return gameEventList;
|
||||
}
|
||||
int getPrivatePlayerId() const
|
||||
{
|
||||
return privatePlayerId;
|
||||
}
|
||||
|
||||
void enqueueGameEvent(const ::google::protobuf::Message &event,
|
||||
int playerId,
|
||||
GameEventStorageItem::EventRecipients recipients = GameEventStorageItem::SendToPrivate |
|
||||
GameEventStorageItem::SendToOthers,
|
||||
int _privatePlayerId = -1);
|
||||
void sendToGame(Server_Game *game);
|
||||
};
|
||||
|
||||
class ResponseContainer {
|
||||
class ResponseContainer
|
||||
{
|
||||
private:
|
||||
int cmdId;
|
||||
::google::protobuf::Message *responseExtension;
|
||||
QList<QPair<ServerMessage::MessageType, ::google::protobuf::Message *> > preResponseQueue, postResponseQueue;
|
||||
QList<QPair<ServerMessage::MessageType, ::google::protobuf::Message *>> preResponseQueue, postResponseQueue;
|
||||
|
||||
public:
|
||||
ResponseContainer(int _cmdId);
|
||||
~ResponseContainer();
|
||||
|
||||
int getCmdId() const { return cmdId; }
|
||||
void setResponseExtension(::google::protobuf::Message *_responseExtension) { responseExtension = _responseExtension; }
|
||||
::google::protobuf::Message *getResponseExtension() const { return responseExtension; }
|
||||
void enqueuePreResponseItem(ServerMessage::MessageType type, ::google::protobuf::Message *item) { preResponseQueue.append(qMakePair(type, item)); }
|
||||
void enqueuePostResponseItem(ServerMessage::MessageType type, ::google::protobuf::Message *item) { postResponseQueue.append(qMakePair(type, item)); }
|
||||
const QList<QPair<ServerMessage::MessageType, ::google::protobuf::Message *> > &getPreResponseQueue() const { return preResponseQueue; }
|
||||
const QList<QPair<ServerMessage::MessageType, ::google::protobuf::Message *> > &getPostResponseQueue() const { return postResponseQueue; }
|
||||
|
||||
int getCmdId() const
|
||||
{
|
||||
return cmdId;
|
||||
}
|
||||
void setResponseExtension(::google::protobuf::Message *_responseExtension)
|
||||
{
|
||||
responseExtension = _responseExtension;
|
||||
}
|
||||
::google::protobuf::Message *getResponseExtension() const
|
||||
{
|
||||
return responseExtension;
|
||||
}
|
||||
void enqueuePreResponseItem(ServerMessage::MessageType type, ::google::protobuf::Message *item)
|
||||
{
|
||||
preResponseQueue.append(qMakePair(type, item));
|
||||
}
|
||||
void enqueuePostResponseItem(ServerMessage::MessageType type, ::google::protobuf::Message *item)
|
||||
{
|
||||
postResponseQueue.append(qMakePair(type, item));
|
||||
}
|
||||
const QList<QPair<ServerMessage::MessageType, ::google::protobuf::Message *>> &getPreResponseQueue() const
|
||||
{
|
||||
return preResponseQueue;
|
||||
}
|
||||
const QList<QPair<ServerMessage::MessageType, ::google::protobuf::Message *>> &getPostResponseQueue() const
|
||||
{
|
||||
return postResponseQueue;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue