~ubuntu-branches/ubuntu/maverick/lordsawar/maverick

« back to all changes in this revision

Viewing changes to src/File.h

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese
  • Date: 2010-04-10 09:29:33 UTC
  • mfrom: (1.1.9 upstream) (5.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20100410092933-23uq4dxig30kmtcw
Tags: 0.1.8-1
* New upstream release.
* Add misc:Depends for -data package.
* Bump Standards Version to 3.8.4. (No changes needed).

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include <list>
27
27
 
28
28
#include "xmlhelper.h"
29
 
class Armyset;
30
 
class Tileset;
31
 
class Shieldset;
32
 
class Cityset;
33
29
 
34
30
/** \brief Miscellaneous functions for file access
35
31
  * 
43
39
class File
44
40
{
45
41
    public:
46
 
        /** Scan the system data directories for armysets
47
 
          * 
48
 
          * @return a list of available armysets
49
 
          */
50
 
        static std::list<std::string> scanArmysets();
51
 
 
52
 
        // get the available armysets in the user's personal collection
53
 
        static std::list<std::string> scanUserArmysets();
54
 
 
55
 
        /** Get the armyset description file
56
 
          *
57
 
          * @param armysetsubdir    the name of the armyset.
58
 
          * @return the full name of the description file
59
 
          */
60
 
        static std::string getArmyset(std::string armysetsubdir);
61
 
 
62
 
        /** Get the armyset description file from the user's personal collection
63
 
          *
64
 
          * @param armysetsubdir    the name of the armyset.
65
 
          * @return the full name of the description file
66
 
          */
67
 
        static std::string getUserArmyset(std::string armysetsubdir);
68
 
 
69
42
        //! Get the directory where personal armysets live.
70
43
        static std::string getUserArmysetDir();
71
44
 
72
45
        //! Get the directory where system armysets live.
73
46
        static std::string getArmysetDir();
74
47
 
75
 
        //! Get the director where the given armyset lives.
76
 
        static std::string getArmysetDir(Armyset *armyset);
77
 
 
78
 
        //! Gets the description file for the given armyset.
79
 
        static std::string getArmyset(Armyset *armyset);
80
 
 
81
 
        // get an path for a file belonging to the given armyset.
82
 
        static std::string getArmysetFile(Armyset *armyset, std::string pic);
83
 
 
84
 
 
85
 
        /** Scan the system data directories for tilesets
86
 
          * 
87
 
          * @return a list of available tilesets
88
 
          */
89
 
        static std::list<std::string> scanTilesets();
90
 
 
91
 
        // get the available tilesets in the user's personal collection
92
 
        static std::list<std::string> scanUserTilesets();
93
 
 
94
 
        /** Get the tileset description file
95
 
          *
96
 
          * @param tilesetsubdir    the dir name of the tileset.
97
 
          * @return the full name of the description file
98
 
          */
99
 
        static std::string getTileset(std::string tilesetsubdir);
100
 
 
101
 
        /** Get the tileset description file from the user's personal collection
102
 
          *
103
 
          * @param tilesetsubdir    the name of the tileset.
104
 
          * @return the full name of the description file
105
 
          */
106
 
        static std::string getUserTileset(std::string tilesetsubdir);
107
 
 
108
48
        //! Get the directory where personal tilesets live.
109
49
        static std::string getUserTilesetDir();
110
50
 
111
51
        //! Get the directory where system tilesets live.
112
52
        static std::string getTilesetDir();
113
53
 
114
 
        //! Get the director where the given tileset lives.
115
 
        static std::string getTilesetDir(Tileset *tileset);
116
 
 
117
 
        //! Gets the description file for the given tileset.
118
 
        static std::string getTileset(Tileset *tileset);
119
 
 
120
 
        // get a path of a file in the given Tileset.
121
 
        static std::string getTilesetFile(Tileset *tileset, std::string pic);
122
 
 
123
 
        /** Scan the system data directories for shieldsets 
124
 
          * 
125
 
          * @return a list of available shieldsets
126
 
          */
127
 
        static std::list<std::string> scanShieldsets();
128
 
 
129
 
        /** Scan the personal data directories for shieldsets 
130
 
          * 
131
 
          * @return a list of available shieldsets
132
 
          */
133
 
        static std::list<std::string> scanUserShieldsets();
134
 
 
135
 
        /** Get the shieldset description file
136
 
          *
137
 
          * @param shieldsetsubdir    the dir name of the shieldset.
138
 
          * @return the full name of the description file
139
 
          */
140
 
        static std::string getShieldset(std::string shieldsetsubdir);
141
 
 
142
 
        /** Get the shieldset conf file from the user's personal collection
143
 
          *
144
 
          * @param shieldsetsubdir    the name of the shieldset.
145
 
          * @return the full name of the description file
146
 
          */
147
 
        static std::string getUserShieldset(std::string shieldsetsubdir);
148
 
 
149
54
        //! Get the directory where personal shieldsets live.
150
55
        static std::string getUserShieldsetDir();
151
56
 
152
57
        //! Get the directory where system shieldsets live.
153
58
        static std::string getShieldsetDir();
154
59
 
155
 
        //! Get the director where the given shieldset lives.
156
 
        static std::string getShieldsetDir(Shieldset *shieldset);
157
 
 
158
 
        //! Gets the description file for the given shieldset.
159
 
        static std::string getShieldset(Shieldset *shieldset);
160
 
 
161
 
        // get a path of a file in the given Shieldset.
162
 
        static std::string getShieldsetFile(Shieldset *shieldset, std::string pic);
163
 
 
164
 
 
165
 
 
166
 
        /** Scan the system data directories for citysets
167
 
          * 
168
 
          * @return a list of available citysets
169
 
          */
170
 
        static std::list<std::string> scanCitysets();
171
 
 
172
 
        // get the available citysets in the user's personal collection
173
 
        static std::list<std::string> scanUserCitysets();
174
 
 
175
 
        /** Get the cityset description file
176
 
          *
177
 
          * @param citysetsubdir    the dir name of the cityset.
178
 
          * @return the full name of the description file
179
 
          */
180
 
        static std::string getCityset(std::string citysetsubdir);
181
 
 
182
 
        /** Get the cityset description file from the user's personal collection
183
 
          *
184
 
          * @param citysetsubdir    the name of the cityset.
185
 
          * @return the full name of the description file
186
 
          */
187
 
        static std::string getUserCityset(std::string citysetsubdir);
188
 
 
189
60
        //! Get the directory where personal citysets live.
190
61
        static std::string getUserCitysetDir();
191
62
 
192
63
        //! Get the directory where system citysets live.
193
64
        static std::string getCitysetDir();
194
65
 
195
 
        //! Get the director where the given cityset lives.
196
 
        static std::string getCitysetDir(Cityset *cityset);
197
 
 
198
 
        //! Gets the description file for the given cityset.
199
 
        static std::string getCityset(Cityset *cityset);
200
 
 
201
 
        // get a path of a file in the given cityset.
202
 
        static std::string getCitysetFile(Cityset *cityset, std::string pic);
203
 
        
204
66
        //! load misc file, e.g. hero names 
205
67
        static std::string getMiscFile(std::string filename);
206
68
        
253
115
        //! does a file exist?
254
116
        static bool exists(std::string f);
255
117
 
 
118
        //! does filename end with extension?
 
119
        static bool nameEndsWith(std::string filename, std::string extension);
 
120
 
 
121
        //! delete a file from the filesystem.
 
122
        static void erase(std::string filename);
 
123
 
 
124
        //! delete an empty directory from the filesystem.
 
125
        static void erase_dir(std::string filename);
 
126
 
 
127
        static std::string add_slash_if_necessary(std::string dir);
 
128
 
 
129
        static std::string getSetConfigurationFilename(std::string dir, std::string subdir, std::string ext);
 
130
 
 
131
        static std::string get_dirname(std::string path);
 
132
 
 
133
        static std::list<std::string> scanFiles(std::string dir, std::string ext);
256
134
};
257
135
 
258
136
#endif //FILE_H