Cockatrice
2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Toggle main menu visibility
Loading...
Searching...
No Matches
arrow_registry.h
Go to the documentation of this file.
1
#ifndef COCKATRICE_ARROW_REGISTRY_H
2
#define COCKATRICE_ARROW_REGISTRY_H
3
4
#include <QList>
5
#include <QMap>
6
#include <QSet>
7
8
class
ArrowItem
;
9
struct
ArrowData
;
10
template
<
class
T>
class
QSharedPointer
;
11
12
struct
ArrowKey
13
{
14
int
creatorId
;
15
int
arrowId
;
16
17
bool
operator<
(
const
ArrowKey
&other)
const
18
{
19
if
(
creatorId
!= other.
creatorId
) {
20
return
creatorId
< other.
creatorId
;
21
}
22
return
arrowId
< other.
arrowId
;
23
}
24
};
25
26
class
ArrowRegistry
27
{
28
public
:
29
void
insert
(
QSharedPointer<ArrowData>
data,
ArrowItem
*arrow);
30
ArrowItem
*
take
(
int
creatorId,
int
arrowId);
31
32
[[nodiscard]]
ArrowItem
*
get
(
int
creatorId,
int
arrowId)
const
;
33
[[nodiscard]]
bool
contains
(
int
creatorId,
int
arrowId)
const
;
34
[[nodiscard]]
QSet<int>
idsForPlayer
(
int
playerId)
const
;
35
[[nodiscard]]
QList<ArrowItem *>
all
()
const
;
36
37
private
:
38
QMap<ArrowKey, QSharedPointer<ArrowData>
>
dataStore
;
39
QMap<ArrowKey, ArrowItem *>
items
;
40
QMap<int, QSet<int>
>
byPlayer
;
41
};
42
43
#endif
ArrowItem
Definition
arrow_item.h:28
ArrowRegistry
Definition
arrow_registry.h:27
ArrowRegistry::dataStore
QMap< ArrowKey, QSharedPointer< ArrowData > > dataStore
Definition
arrow_registry.h:38
ArrowRegistry::byPlayer
QMap< int, QSet< int > > byPlayer
Definition
arrow_registry.h:40
ArrowRegistry::idsForPlayer
QSet< int > idsForPlayer(int playerId) const
Definition
arrow_registry.cpp:43
ArrowRegistry::all
QList< ArrowItem * > all() const
Definition
arrow_registry.cpp:48
ArrowRegistry::items
QMap< ArrowKey, ArrowItem * > items
Definition
arrow_registry.h:39
ArrowRegistry::get
ArrowItem * get(int creatorId, int arrowId) const
Definition
arrow_registry.cpp:33
ArrowRegistry::insert
void insert(QSharedPointer< ArrowData > data, ArrowItem *arrow)
Definition
arrow_registry.cpp:8
ArrowRegistry::contains
bool contains(int creatorId, int arrowId) const
Definition
arrow_registry.cpp:38
ArrowRegistry::take
ArrowItem * take(int creatorId, int arrowId)
Definition
arrow_registry.cpp:21
QList
Definition
remote_connection_controller.h:20
QMap
Definition
game.h:18
QSet
Definition
dlg_manage_sets.h:29
QSharedPointer
Definition
arrow_registry.h:10
ArrowData
Definition
arrow_data.h:10
ArrowKey
Definition
arrow_registry.h:13
ArrowKey::operator<
bool operator<(const ArrowKey &other) const
Definition
arrow_registry.h:17
ArrowKey::arrowId
int arrowId
Definition
arrow_registry.h:15
ArrowKey::creatorId
int creatorId
Definition
arrow_registry.h:14
cockatrice
src
game
arrow_registry.h
Generated by
1.18.0