Crossfire Server, Trunk
CREFilterDefinitionManager.cpp
Go to the documentation of this file.
1
/*
2
* Crossfire -- cooperative multi-player graphical RPG and adventure game
3
*
4
* Copyright (c) 2022 the Crossfire Development Team
5
*
6
* Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
7
* welcome to redistribute it under certain conditions. For details, please
8
* see COPYING and LICENSE.
9
*
10
* The authors can be reached via e-mail at <crossfire@metalforge.org>.
11
*/
12
13
#include "
CREFilterDefinitionManager.h
"
14
#include "
CREFilterDefinition.h
"
15
#include <QDataStream>
16
17
CREFilterDefinitionManager::CREFilterDefinitionManager
()
18
{
19
}
20
21
CREFilterDefinitionManager::CREFilterDefinitionManager
(
const
CREFilterDefinitionManager
& other) : QObject()
22
{
23
copy
(other);
24
}
25
26
CREFilterDefinitionManager::~CREFilterDefinitionManager
()
27
{
28
qDeleteAll(
myFilters
);
29
}
30
31
void
CREFilterDefinitionManager::copy
(
const
CREFilterDefinitionManager
& other)
32
{
33
qDeleteAll(
myFilters
);
34
myFilters
.clear();
35
for
(
int
f = 0; f < other.
filters
().size(); f++)
36
{
37
myFilters
.append(
new
CREFilterDefinition
(*other.
filters
()[f]));
38
}
39
}
40
41
QList<CREFilterDefinition*>&
CREFilterDefinitionManager::filters
()
42
{
43
return
myFilters
;
44
}
45
46
const
QList<CREFilterDefinition*>&
CREFilterDefinitionManager::filters
()
const
47
{
48
return
myFilters
;
49
}
50
51
QDataStream &
operator<<
(QDataStream &
out
,
const
CREFilterDefinitionManager
&
manager
)
52
{
53
out
<<
manager
.filters().size();
54
for
(
int
f = 0; f <
manager
.filters().size(); f++)
55
out
<< (*
manager
.filters()[f]);
56
return
out
;
57
}
58
59
QDataStream &
operator>>
(QDataStream &in,
CREFilterDefinitionManager
&
manager
)
60
{
61
int
size;
62
in >> size;
63
while
(size > 0)
64
{
65
CREFilterDefinition
*
filter
=
new
CREFilterDefinition
();
66
in >> (*filter);
67
manager
.filters().append(
filter
);
68
size--;
69
}
70
return
in;
71
}
CREFilterDefinitionManager
Definition:
CREFilterDefinitionManager.h:21
filter
Definition:
filter.py:1
CREFilterDefinition.h
operator>>
QDataStream & operator>>(QDataStream &in, CREFilterDefinitionManager &manager)
Definition:
CREFilterDefinitionManager.cpp:59
CREFilterDefinitionManager::~CREFilterDefinitionManager
virtual ~CREFilterDefinitionManager()
Definition:
CREFilterDefinitionManager.cpp:26
CREFilterDefinitionManager::CREFilterDefinitionManager
CREFilterDefinitionManager()
Definition:
CREFilterDefinitionManager.cpp:17
make_face_from_files.out
out
Definition:
make_face_from_files.py:81
CREFilterDefinitionManager.h
CREFilterDefinitionManager::copy
void copy(const CREFilterDefinitionManager &other)
Definition:
CREFilterDefinitionManager.cpp:31
operator<<
QDataStream & operator<<(QDataStream &out, const CREFilterDefinitionManager &manager)
Definition:
CREFilterDefinitionManager.cpp:51
CREFilterDefinition
Definition:
CREFilterDefinition.h:19
CREFilterDefinitionManager::myFilters
QList< CREFilterDefinition * > myFilters
Definition:
CREFilterDefinitionManager.h:36
manager
static AssetsManager * manager
Definition:
assets.cpp:60
CREFilterDefinitionManager::filters
QList< CREFilterDefinition * > & filters()
Definition:
CREFilterDefinitionManager.cpp:41
crossfire-crossfire-server
utils
cre
CREFilterDefinitionManager.cpp
Generated by
1.8.17