diff system/file_impl.h @ 52:15a18fbe6f21

* Known bugs added to the README * Code cleaning (0 -> NULL when needed, indentation, spaces, ...)
author thib
date Sat, 18 Apr 2009 18:35:39 +0000
parents 35ce1a30f3f9
children 4416cfac86ae
line wrap: on
line diff
--- a/system/file_impl.h
+++ b/system/file_impl.h
@@ -30,7 +30,7 @@
 #ifndef __FILE_IMPL_H__
 #define __FILE_IMPL_H__
 
-#include<vector>
+#include <vector>
 
 struct ARCFILE_ATOM {
 	char* filename;
@@ -48,110 +48,117 @@ struct ARCFILE_ATOM {
 };
 
 class ARCFILE {
-protected:
-	char* arcname;
-	char* filenames_orig;
-	int list_point;
-	std::vector<ARCFILE_ATOM> arc_atom;
-	typedef std::vector<ARCFILE_ATOM>::iterator iterator;
-	ARCFILE* next; /* FILESEARCH の一つの型が複数の ARCFILE を持つとき、リストをつくる */
-	/* arcname に指定されたファイル/ディレクトリの内容チェック */
-	virtual int CheckFileDeal(void);
-	virtual void ListupFiles(int fname_len);
-	virtual ARCINFO* MakeARCINFO(ARCFILE_ATOM&);
-	iterator SearchName(const char* f, const char* ext=0);
-public:
-	ARCFILE(const char* fname);
-	void SetNext(ARCFILE* _next) { delete next; next = _next;}
-	ARCFILE* Next(void) { return next; }
-	void Init(void);
-	virtual ~ARCFILE();
-	/* ファイル検索 */
-	class ARCINFO* Find(const char* fname, const char* ext);
-	/* ファイルリストの出力 */
-	int Deal(void) { Init(); return arc_atom.size(); }
-	void ListFiles(FILE* out);
-	void InitList(void);
-	char* ListItem(void);
+	protected:
+		char* arcname;
+		char* filenames_orig;
+		int list_point;
+		std::vector<ARCFILE_ATOM> arc_atom;
+		typedef std::vector<ARCFILE_ATOM>::iterator iterator;
+		ARCFILE* next; /* FILESEARCH の一つの型が複数の ARCFILE を持つとき、リストをつくる */
+		/* arcname に指定されたファイル/ディレクトリの内容チェック */
+		virtual int CheckFileDeal(void);
+		virtual void ListupFiles(int fname_len);
+		virtual ARCINFO* MakeARCINFO(ARCFILE_ATOM&);
+		iterator SearchName(const char* f, const char* ext=0);
+	public:
+		ARCFILE(const char* fname);
+		void SetNext(ARCFILE* _next) { delete next; next = _next;}
+		ARCFILE* Next(void) { return next; }
+		void Init(void);
+		virtual ~ARCFILE();
+		/* ファイル検索 */
+		class ARCINFO* Find(const char* fname, const char* ext);
+		/* ファイルリストの出力 */
+		int Deal(void) { Init(); return arc_atom.size(); }
+		void ListFiles(FILE* out);
+		void InitList(void);
+		char* ListItem(void);
 };
 
 class SCN2kFILE : public ARCFILE {
-protected:
-	virtual int CheckFileDeal(void);
-	virtual void ListupFiles(int fname_len);
-	virtual ARCINFO* MakeARCINFO(ARCFILE_ATOM& atom);
-public:
-	SCN2kFILE(char* fname) : ARCFILE(fname) {}
-	virtual ~SCN2kFILE() {}
+	protected:
+		virtual int CheckFileDeal(void);
+		virtual void ListupFiles(int fname_len);
+		virtual ARCINFO* MakeARCINFO(ARCFILE_ATOM& atom);
+	public:
+		SCN2kFILE(char* fname) : ARCFILE(fname) {}
+		virtual ~SCN2kFILE() {}
 };
 
 class CattleyaFILE : public ARCFILE {
-	bool is_compress;
-	/* header の Huffman 木構築用 */
-	char* bitbuf;
-	char* bitbuf_end;
-	int ltree[0x400];
-	int rtree[0x400];
-	int treecnt;
-	int bitcnt;
-	int GetBit(void);
-	int GetCh(void);
-	void SetBuf(char* buf, int len);
-	int MakeTree(void);
-	int Decode(int seed);
+	private:
+		bool is_compress;
+		/* header の Huffman 木構築用 */
+		char* bitbuf;
+		char* bitbuf_end;
+		int ltree[0x400];
+		int rtree[0x400];
+		int treecnt;
+		int bitcnt;
+		int GetBit(void);
+		int GetCh(void);
+		void SetBuf(char* buf, int len);
+		int MakeTree(void);
+		int Decode(int seed);
 
-protected:
-	virtual int CheckFileDeal(void);
-	virtual void ListupFiles(int fname_len);
-	virtual ARCINFO* MakeARCINFO(ARCFILE_ATOM& atom);
-public:
-	CattleyaFILE(char* fname) : ARCFILE(fname) {is_compress = false;}
-	virtual ~CattleyaFILE() {}
+	protected:
+		virtual int CheckFileDeal(void);
+		virtual void ListupFiles(int fname_len);
+		virtual ARCINFO* MakeARCINFO(ARCFILE_ATOM& atom);
+
+	public:
+		CattleyaFILE(char* fname) : ARCFILE(fname) {is_compress = false;}
+		virtual ~CattleyaFILE() {}
 };
 
 class NULFILE : public ARCFILE {
-protected:
-	virtual int CheckFileDeal(void);
-	virtual void ListupFiles(int fname_len);
-	virtual ARCINFO* MakeARCINFO(ARCFILE_ATOM& atom);
-public:
-	NULFILE() : ARCFILE("") {}
-	virtual ~NULFILE() {}
+	protected:
+		virtual int CheckFileDeal(void);
+		virtual void ListupFiles(int fname_len);
+		virtual ARCINFO* MakeARCINFO(ARCFILE_ATOM& atom);
+	public:
+		NULFILE() : ARCFILE("") {}
+		virtual ~NULFILE() {}
 };
+
 class DIRFILE : public ARCFILE {
-protected:
-	virtual int CheckFileDeal(void);
-	virtual void ListupFiles(int fname_len);
-	virtual ARCINFO* MakeARCINFO(ARCFILE_ATOM& atom);
-public:
-	DIRFILE(char* fname) : ARCFILE(fname) {}
-	virtual ~DIRFILE() {}
-	FILE* Open(const char* fname); /* FILE* を開く */
-	char* SearchFile(const char* dirname); /* ファイル検索 */
+	protected:
+		virtual int CheckFileDeal(void);
+		virtual void ListupFiles(int fname_len);
+		virtual ARCINFO* MakeARCINFO(ARCFILE_ATOM& atom);
+	public:
+		DIRFILE(char* fname) : ARCFILE(fname) {}
+		virtual ~DIRFILE() {}
+		FILE* Open(const char* fname); /* FILE* を開く */
+		char* SearchFile(const char* dirname); /* ファイル検索 */
 };
+
 class ARCINFO_AVG32 : public ARCINFO {
-	ARCINFO_AVG32(const char* name, ARCFILE_ATOM& atom) : ARCINFO(name, atom) {
-	}
-	virtual bool ExecExtract(void);
-	friend class ARCFILE;
+	protected:
+		ARCINFO_AVG32(const char* name, ARCFILE_ATOM& atom) : ARCINFO(name, atom) {
+		}
+		virtual bool ExecExtract(void);
+		friend class ARCFILE;
 };
+
 class ARCINFO2k : public ARCINFO {
-	static char decode_seed[256];
-	static char decode_seed2[16];
-protected:
-	ARCINFO2k(const char* name, ARCFILE_ATOM& atom) : ARCINFO(name,atom) {
-	}
-	virtual bool ExecExtract(void);
-	friend class SCN2kFILE;
+	private:
+		static char decode_seed[256];
+		static char decode_seed2[16];
+	protected:
+		ARCINFO2k(const char* name, ARCFILE_ATOM& atom) : ARCINFO(name,atom) {
+		}
+		virtual bool ExecExtract(void);
+		friend class SCN2kFILE;
 };
 
 class ARCINFOZ : public ARCINFO {
-protected:
-	ARCINFOZ(const char* name, ARCFILE_ATOM& atom) : ARCINFO(name, atom) {
-	}
-	virtual bool ExecExtract(void);
-	friend class DaemonBaneFILE;
-	friend class CattleyaFILE;
+	protected:
+		ARCINFOZ(const char* name, ARCFILE_ATOM& atom) : ARCINFO(name, atom) {
+		}
+		virtual bool ExecExtract(void);
+		friend class DaemonBaneFILE;
+		friend class CattleyaFILE;
 };
 
 #endif /* __FILE_IMPL_H__ */