SaveGameIterator: Change std::list to std::vector.
[gemrb.git] / gemrb / core / SaveGameIterator.h
blob37918ceb2a2f310727f52fc9189628f40ad3ef8a
1 /* GemRB - Infinity Engine Emulator
2 * Copyright (C) 2003 The GemRB Project
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #ifndef SAVEGAMEITERATOR_H
22 #define SAVEGAMEITERATOR_H
24 #include <time.h>
25 #include <sys/stat.h>
26 #include <vector>
27 #include "exports.h"
28 #include "FileStream.h"
29 #include "ResourceManager.h"
31 #define SAVEGAME_DIRECTORY_MATCHER "%d - %[A-Za-z0-9- _]"
33 class ImageMgr;
35 class GEM_EXPORT SaveGame {
36 public:
37 SaveGame(const char* path, const char* name, const char* prefix, const char* slotname, int pCount, int saveID);
38 ~SaveGame();
39 int GetPortraitCount()
41 return PortraitCount;
43 int GetSaveID()
45 return SaveID;
47 const char* GetName()
49 return Name;
51 const char* GetPrefix()
53 return Prefix;
55 const char* GetPath()
57 return Path;
59 const char* GetDate()
61 return Date;
63 const char* GetGameDate();
64 const char* GetSlotName()
66 return SlotName;
69 Sprite2D* GetPortrait(int index);
70 Sprite2D* GetPreview();
71 DataStream* GetGame();
72 DataStream* GetWmap();
73 DataStream* GetSave();
74 private:
75 char Path[_MAX_PATH];
76 char Prefix[10];
77 char Name[_MAX_PATH];
78 char Date[_MAX_PATH];
79 char GameDate[_MAX_PATH];
80 char SlotName[_MAX_PATH];
81 int PortraitCount;
82 int SaveID;
83 ResourceManager manager;
86 typedef std::vector<char*> charlist;
88 class GEM_EXPORT SaveGameIterator {
89 private:
90 bool loaded;
91 charlist save_slots;
93 public:
94 SaveGameIterator(void);
95 ~SaveGameIterator(void);
96 void Invalidate();
97 bool RescanSaveGames();
98 int GetSaveGameCount();
99 SaveGame* GetSaveGame(int index);
100 void DeleteSaveGame(int index);
101 int ExistingSlotName(int index);
102 int CreateSaveGame(int index, const char *slotname, bool mqs = false);
103 private:
104 char *GetSaveName(int index);
105 void PruneQuickSave(const char *folder);
108 #endif