/******************************************************************************
*	File		-	binary_file_buffer.h
*	Author		-	Joey Pollack
*	Date		-	2020/01/24 (y/m/d)
*	Mod Date	-	2020/01/24 (y/m/d)
*	Description	-	Reads an entire binary file into memory and allows for
*					extracting the data in chunks. Much faster than reading
*					large files chunk by chunk.
******************************************************************************/

#ifndef BINARY_FILE_BUFFER_H_
#define BINARY_FILE_BUFFER_H_

#include <string>

namespace lunarium
{
	class BinaryFileBuffer
	{
	public:
		BinaryFileBuffer();
		~BinaryFileBuffer();

		bool LoadFile(const char* filename);
		void Unload();
		bool IsLoaded() const;
		const std::string& LoadedFileName() const;
		int GetFileSize() const;
		const unsigned char* GetBuffer() const;

		bool Read(char* buffer, int numBytes);
		void SeekTo(int pos);

	private:

		bool mbIsLoaded;
		std::string mFileName;
		int mFileSize;
		unsigned char* mpData;
		int mReadPos;

	};
}

#endif	// BINARY_FILE_BUFFER_H_