fileform.h

来自「《3D游戏引擎设计》的源码」· C头文件 代码 · 共 74 行

H
74
字号
#ifndef FILEFORM_H
#define FILEFORM_H

#include <iostream.h>

class mgcFileFormat
{
// data base management system
public:
	typedef int (*FFquery)(char*);
	typedef int (*FFgethead)(char*,int*,int**,char*,int*);
	typedef int (*FFputhead)(char*,int,const int*,const char*,int);
	typedef int (*FFdata)(char*,long,int,char*);
	typedef int (*FFmessage)(char*,void*);

	typedef struct {
		int id;
		FFquery query;
		FFgethead gethead;
		FFputhead puthead;
		FFdata    getdata;
		FFdata    putdata;
		FFmessage getmessage;
		FFmessage putmessage;
	} RegisteredFileFormat;

	static int CreateDataBase ();
	static void DestroyDataBase ();

	static int AddFileFormat (
		FFquery query,
		FFgethead gethead,
		FFputhead puthead,
		FFdata getdata,
		FFdata putdata,
		FFmessage getmessage,
		FFmessage putmessage
	);

	static int not_openable;
	static int not_recognized;
	static int Query (char* filename);

	static int Valid (int id)
		{ return (0 <= id && id < registered); }
	static RegisteredFileFormat& RFF (int id)
		{ return fileformat[id]; }

	static int default_format;

private:
	static int maxregistered;
	static int registered;
	static RegisteredFileFormat* fileformat;

// error handling
public:
	static int verbose;
	static unsigned error;
	static void Report (ostream& ostr);
private:
	static const unsigned allocation_failed;
	static const unsigned exceeded_maximum;
	static const char* message[2];
	static int Number (unsigned single_error);
	static void Report (unsigned single_error);
};

// automatic creation of data base
static int create_fdb = mgcFileFormat::CreateDataBase();

#endif

⌨️ 快捷键说明

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