1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-30 08:57:00 +02:00
vcmi/hch/CSndHandler.h

60 lines
1.6 KiB
C
Raw Normal View History

#ifndef CSNDHANDLER_H
#define CSNDHANDLER_H
2007-07-07 07:30:36 +03:00
#include <vector>
#include <fstream>
#include <map>
struct MemberFile
{
std::ifstream * ifs;
int length;
};
2007-07-07 07:30:36 +03:00
class CSndHandler
{
protected:
const int CHUNK;
struct Entry
{
std::string name;
int size, offset;
};
std::ifstream file;
int readNormalNr (int pos, int bytCon);
bool opened;
public:
std::vector<Entry> entries;
std::map<std::string, int> fimap; // map of wav file and index
2007-07-07 07:30:36 +03:00
~CSndHandler();
CSndHandler(std::string fname);
void extract(std::string srcfile, std::string dstfile, bool caseSens=true); //saves selected file
unsigned char * extract (std::string srcfile, int & size); //return selecte file data, NULL if file doesn't exist
2007-07-07 07:30:36 +03:00
void extract(int index, std::string dstfile); //saves selected file
MemberFile getFile(std::string name);//nie testowane - sprawdzic
2007-07-07 07:30:36 +03:00
unsigned char * extract (int index, int & size); //return selecte file - NIE TESTOWANE
};
class CVidHandler
{
protected:
const int CHUNK;
struct Entry
{
std::string name;
int size, offset, something;
};
std::ifstream file;
int readNormalNr (int pos, int bytCon);
bool opened;
public:
std::vector<Entry> entries;
~CVidHandler();
CVidHandler(std::string fname);
std::ifstream & extract(std::string srcfile);
void extract(std::string srcfile, std::string dstfile, bool caseSens=true); //saves selected file
unsigned char * extract (std::string srcfile, int & size); //return selecte file,
void extract(int index, std::string dstfile); //saves selected file
MemberFile getFile(std::string name); //nie testowane - sprawdzic
};
#endif //CSNDHANDLER_H