Emergency 20 Dokumentation  4.2.0
LoadCampaignDataSource.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Header guard ]
6 //[-------------------------------------------------------]
7 #pragma once
8 
9 
10 //[-------------------------------------------------------]
11 //[ Includes ]
12 //[-------------------------------------------------------]
14 
15 #include <Rocket/Controls/DataSource.h>
16 
17 
18 //[-------------------------------------------------------]
19 //[ Namespace ]
20 //[-------------------------------------------------------]
21 namespace em5
22 {
23 
24 
25  //[-------------------------------------------------------]
26  //[ Classes ]
27  //[-------------------------------------------------------]
32  class LoadCampaignDataSource : public Rocket::Controls::DataSource
33  {
34 
35 
36  //[-------------------------------------------------------]
37  //[ Public methods ]
38  //[-------------------------------------------------------]
39  public:
41  virtual ~LoadCampaignDataSource();
42  void addNewSaveGame();
43  void holdNewSaveGame(const Rocket::Core::String& filename);
44  void removeNewSaveGame();
45  void removeSaveGameByIndex(uint32 index);
48  void rebuidFirstRows();
49  void rebuidDatagrid();
50 
51 
52  //[-------------------------------------------------------]
53  //[ Public virtual Rocket::Controls::DataSource methods ]
54  //[-------------------------------------------------------]
55  public:
56  virtual void GetRow(Rocket::Core::StringList& row, const Rocket::Core::String& table, int rowIndex, const Rocket::Core::StringList& columns) override;
57  virtual int GetNumRows(const Rocket::Core::String& table) override;
58 
59 
60  //[-------------------------------------------------------]
61  //[ Private definitions ]
62  //[-------------------------------------------------------]
63  private:
64  struct TableData
65  {
66  gamemode::Type gameMode;
67  uint32 campaignIndex;
71  Rocket::Core::String file; // This is our filename
72  Rocket::Core::String newFile;
73  std::string completeTimeString;
74 
75  struct sortDate
76  {
77  bool operator() (TableData* a, TableData* b)
78  {
79  return (a->completeTimeString > b->completeTimeString);
80  }
81  };
82  };
83 
84 
85  //[-------------------------------------------------------]
86  //[ Private data ]
87  //[-------------------------------------------------------]
88  private:
89  std::vector<TableData*> mTableData;
90 
91 
92  };
93 
94 
95 //[-------------------------------------------------------]
96 //[ Namespace ]
97 //[-------------------------------------------------------]
98 } // em5
Definition: ActionPriority.h:13
Load campaign data source.
Definition: LoadCampaignDataSource.h:32
unsigned int uint32
Definition: PlatformTypes.h:181
void holdNewSaveGame(const Rocket::Core::String &filename)
bool operator()(TableData *a, TableData *b)
Definition: LoadCampaignDataSource.h:77
const Rocket::Core::String & getFileNameByIndex(uint32 index) const
virtual void GetRow(Rocket::Core::StringList &row, const Rocket::Core::String &table, int rowIndex, const Rocket::Core::StringList &columns) override
Definition: LoadCampaignDataSource.h:75
Definition: MiniMapWindow.h:43
virtual int GetNumRows(const Rocket::Core::String &table) override
void removeSaveGameByIndex(uint32 index)
const Rocket::Core::String & getCompleteFileNameByIndex(uint32 index) const
Type
Definition: GameModeType.h:21