[7910] Resolve problems with vmaps extractor support 3.1.2 archives.
[getmangos.git] / contrib / vmap_extractor_v2 / vmapextract / mpq.h
blobc1b04c2b3080fa3ab4df902b18bcfc48af32dea4
1 #define _CRT_SECURE_NO_DEPRECATE
3 #ifndef MPQ_H
4 #define MPQ_H
6 #define __STORMLIB_SELF__
8 #include <string.h>
9 #include <ctype.h>
10 #include <vector>
11 #include <iostream>
12 #include "Stormlib.h"
14 using namespace std;
16 typedef unsigned int uint32;
18 class MPQArchive
20 public:
21 HANDLE hMPQ;
22 MPQArchive(const char* filename);
23 void close();
24 bool isOpen() const { return hMPQ != 0; }
27 typedef std::vector<MPQArchive> ArchiveSet;
29 class MPQArchiveSet
31 public:
32 MPQArchiveSet() {}
33 ~MPQArchiveSet();
35 bool Open(std::vector<std::string> const& archiveNames);
37 ArchiveSet archives;
40 extern MPQArchiveSet gOpenArchives;
42 class MPQFile
44 HANDLE hFile;
45 HANDLE hMPQ;
46 bool eof;
47 char *buffer;
48 size_t pointer,
49 size;
51 // disable copying
52 //MPQFile(const MPQFile &f) {}
53 //void operator=(const MPQFile &f) {}
55 public:
56 MPQFile(const char* filename);
57 ~MPQFile();
58 size_t read(void* dest, size_t bytes);
59 size_t getSize();
60 size_t getPos();
61 char* getBuffer();
62 char* getPointer();
63 bool isEof();
64 void seek(int offset);
65 void seekRelative(int offset);
66 void close();
69 inline void flipcc(char *fcc)
71 char t;
72 t=fcc[0];
73 fcc[0]=fcc[3];
74 fcc[3]=t;
75 t=fcc[1];
76 fcc[1]=fcc[2];
77 fcc[2]=t;
80 #endif