// header:
//
// PGF!
// <Type>
// <Version>
// <Size>

#ifndef _PGF_H_
#define _PGF_H_


#include "File.h"


#define PGF_ID_PGF 0x21464750			// PGF!
#define PGF_ID_END 0x21444e45			// END!


class CPhilGenFile : public CFile
{
	private:

		typedef struct
		{
			s32
				Pos,
				Size;
		} SChunkInfo;

		s32
			Writing,
			Depth;
		SChunkInfo
			List[16];


	public:

		s32		CreateFile( const char *filename, const s32 type, const s32 version );
		s32		OpenFile( const char *filename, s32 *type, s32 *version, s32 *size );
		void	CloseFile();

		void	CreateChunk( const s32 type );
		s32		OpenChunk();
		s32		GetChunkSize();
		void	CloseChunk();

		void	WriteByte( const u8 value );
		void	WriteWord( const u16 value );
		void	WriteLong( const u32 value );
		void	WriteString( const char *string );
		void	WriteFloat( const float value );

		u8		ReadByte();
		u16		ReadWord();
		u32		ReadLong();
		u32		ReadString( char *string );
		float	ReadFloat();
};


#endif
