mpq_libmpq.h

来自「wowmodelview魔兽世界的模型查看工具。下了看看吧」· C头文件 代码 · 共 73 行

H
73 行
字号
#ifndef MPQ_H
#define MPQ_H

//#include "SFmpqapi.h"
#include "libmpq/mpq.h"

// C++ files
#include <string>
#include <set>
//#include <stdlib.h>
//#include <crtdbg.h>

//#include <wx/string.h>

// TODO:  Modify MPQFile to check for an existing local file first before reading from the archive.

class MPQArchive
{
	//MPQHANDLE handle;
	mpq_archive mpq_a;
public:
	MPQArchive(const char* filename);
	~MPQArchive();

	void close();
};


class MPQFile
{
	//MPQHANDLE handle;
	bool eof;
	unsigned char *buffer;
	size_t pointer, size;

	// disable copying
	MPQFile(const MPQFile &f) {}
	void operator=(const MPQFile &f) {}

public:
	MPQFile(const char* filename);	// filenames are not case sensitive
	~MPQFile();
	size_t read(void* dest, size_t bytes);
	size_t getSize();
	size_t getPos();
	unsigned char* getBuffer();
	unsigned char* getPointer();
	bool isEof();
	void seek(int offset);
	void seekRelative(int offset);
	void close();

	static bool exists(const char* filename);
};

inline void flipcc(char *fcc)
{
	char t;
	t=fcc[0];
	fcc[0]=fcc[3];
	fcc[3]=t;
	t=fcc[1];
	fcc[1]=fcc[2];
	fcc[2]=t;
}

inline bool defaultFilterFunc(std::string) { return true; }
void getFileLists(std::set<std::string> &dest, bool filterfunc(std::string) = defaultFilterFunc);


#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?