/* ========================================================================== * ÀÛ ¼º ÀÚ : À̼ø±Ô * ÀÛ ¼º ÀÏ : 2008.04.28 * ³» ¿ë : ¿£Áø ÆÄÀÏ * ÁÖÀÇ»çÇ× : *===========================================================================*/ #pragma once #include class cFileToRead; /// ¿£Áø ÆÄÀÏ class cEngineFile : public NiFile { NiDeclareDerivedBinaryStream(); public: cEngineFile( const char* pathName, bool bPack = true );//cFileToRead* fileToRead ); ~cEngineFile(); void Seek( unsigned int offset, int whence ); unsigned int FileRead( void* buffer, unsigned int bytes ); unsigned int GetLine( char* buffer, unsigned int maxBytes ); unsigned int GetFileSize() const; virtual void SetEndianSwap(bool bDoSwap); const cString GetPathName() { return mPathName; } protected: cFileLoader* mFileLoader; cFileToRead* mFileToRead; cString mPathName; }; template inline void StreamLoadBinary( cEngineFile& file, T& value ) { file.Read( &value, sizeof(T) ); } template inline void StreamLoadBinary( cEngineFile& file, T* value, unsigned int bytes ) { unsigned int r = file.Read( value, bytes ); if( r != bytes ) { assert(0); char str[256]= {0,}; ::sprintf_s( str, "Failed [%s] file read.", file.GetPathName() ); NiMessageBox( str,"Error" ); } } template inline void BinaryStreamLoadEnum( cEngineFile& file, T* value ) { int temp; file.Read( &temp, sizeof(int) ); *value = (T)temp; }