Crossfire Server, Trunk
CREReportDefinitionManager.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 
14 #include "CREReportDefinition.h"
15 #include <QDataStream>
16 
18 {
19 }
20 
22 {
23  copy(other);
24 }
25 
27 {
28  qDeleteAll(myReports);
29 }
30 
32 {
33  qDeleteAll(myReports);
34  myReports.clear();
35  for (int f = 0; f < other.reports().size(); f++)
36  {
37  Q_ASSERT(other.reports()[f]);
38  myReports.append(new CREReportDefinition(*other.reports()[f]));
39  }
40 }
41 
42 QList<CREReportDefinition*>& CREReportDefinitionManager::reports()
43 {
44  return myReports;
45 }
46 
47 const QList<CREReportDefinition*>& CREReportDefinitionManager::reports() const
48 {
49  return myReports;
50 }
51 
52 QDataStream &operator<<(QDataStream &out, const CREReportDefinitionManager &manager)
53 {
54  out << manager.reports().size();
55  for (int f = 0; f < manager.reports().size(); f++)
56  out << (*manager.reports()[f]);
57  return out;
58 }
59 
60 QDataStream &operator>>(QDataStream &in, CREReportDefinitionManager &manager)
61 {
62  int size;
63  in >> size;
64  while (size > 0)
65  {
67  in >> (*report);
68  manager.reports().append(report);
69  size--;
70  }
71  return in;
72 }
CREReportDefinitionManager
Definition: CREReportDefinitionManager.h:21
CREReportDefinitionManager.h
CREReportDefinition
Definition: CREReportDefinition.h:19
operator<<
QDataStream & operator<<(QDataStream &out, const CREReportDefinitionManager &manager)
Definition: CREReportDefinitionManager.cpp:52
CREReportDefinition.h
operator>>
QDataStream & operator>>(QDataStream &in, CREReportDefinitionManager &manager)
Definition: CREReportDefinitionManager.cpp:60
CREReportDefinitionManager::reports
QList< CREReportDefinition * > & reports()
Definition: CREReportDefinitionManager.cpp:42
CREReportDefinitionManager::myReports
QList< CREReportDefinition * > myReports
Definition: CREReportDefinitionManager.h:36
make_face_from_files.out
out
Definition: make_face_from_files.py:81
report
Definition: report.py:1
CREReportDefinitionManager::CREReportDefinitionManager
CREReportDefinitionManager()
Definition: CREReportDefinitionManager.cpp:17
manager
static AssetsManager * manager
Definition: assets.cpp:60
CREReportDefinitionManager::copy
void copy(const CREReportDefinitionManager &other)
Definition: CREReportDefinitionManager.cpp:31
CREReportDefinitionManager::~CREReportDefinitionManager
virtual ~CREReportDefinitionManager()
Definition: CREReportDefinitionManager.cpp:26