tar_type.h

Go to the documentation of this file.
00001 /* $Id: tar_type.h 15027 2009-01-12 17:11:45Z truebrain $ */
00002 
00005 #ifndef TAR_TYPE_H
00006 #define TAR_TYPE_H
00007 
00008 #include <map>
00009 #include <string>
00010 
00012 struct TarListEntry {
00013   const char *filename;
00014   const char *dirname;
00015 
00016   /* MSVC goes copying around this struct after initialisation, so it tries
00017    * to free filename, which isn't set at that moment... but because it
00018    * initializes the variable with garbage, it's going to segfault. */
00019   TarListEntry() : filename(NULL), dirname(NULL) {}
00020   ~TarListEntry() { free((void*)this->filename); free((void*)this->dirname); }
00021 };
00022 
00023 struct TarFileListEntry {
00024   const char *tar_filename;
00025   size_t size;
00026   size_t position;
00027 };
00028 
00029 typedef std::map<std::string, TarListEntry> TarList;
00030 typedef std::map<std::string, TarFileListEntry> TarFileList;
00031 extern TarList _tar_list;
00032 extern TarFileList _tar_filelist;
00033 
00034 #define FOR_ALL_TARS(tar) for (tar = _tar_filelist.begin(); tar != _tar_filelist.end(); tar++)
00035 
00036 typedef bool FioTarFileListCallback(const char *filename, int size, void *userdata);
00037 FILE *FioTarFileList(const char *tar, const char *mode, size_t *filesize, FioTarFileListCallback *callback, void *userdata);
00038 
00039 #endif /* TAR_TYPE_H */

Generated on Thu Oct 1 11:03:17 2009 for OpenTTD by  doxygen 1.5.6