1 /***************************************************************************
4 begin : Sun May 27 22:13:58 CEST 2001
5 copyright : (C) 2001 by Michael Andreen
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
20 // include files for QT
26 // application specific includes
29 typedef std::map<QString, std::map<QString, std::map<QString, Fleet*> > > BattleList;
30 //! The document class
31 /** This class is holding all the data, handles the transportation of the
32 * data to a couple of different mediums and informs users of the data
33 * if it's changed (through the documentChnaged() signal)
34 * \bug it's too open..
35 * \todo make this class more closed.
36 * \author Michael Andreen
39 class BSDoc : public QObject
48 bool saveAs(const QString &filename);
49 bool load(const QString &filename);
50 bool isModified() const;
52 /**Adds a new battle to the dokument and emits documentChanged.
53 * \todo add some checks to see if the battle exist and so and return the status.
54 * \return returns 0 if everything is ok.
56 int newBattle(QString name);
58 /**This returns the the data structure, so other can work on it, but not supposed
60 * \todo remove this, and replace it with a better more closed interface.
62 const BattleList& battles() const;
65 /**Looks for the fleet with the specified name, in the specified group in the
67 * \return Returns '\0' (NULL) if the fleet isn't found, if it is found it
68 * returns a const pointer to the fleet.
70 const Fleet* specificFleet(QString battle, QString group, QString fleet) const;
72 void changeFleet(QString battle, QString group, QString fleet, const Fleet* fl);
74 void newFleet(QString battle, QString group, QString fleet, Fleet* fl);
76 void removeFleet(QString battle, QString group, QString fleet);
78 void runBattleSimulation();
82 void documentChanged();
87 /**This is the main datastructure of the battlecalc, it's more or less the
88 * core that everything else works around. A short explanation of the fields:
89 * -# The name of the battle (usually coordinates)
90 * -# The name of the group (ie. Friendly/Hostile)
91 * -# The fleetname (Home Planet, coordinates, irc nicks and so on)
92 * - and in the end you got the actual Fleet object with it's data.