/*
	ZBinaryFileReader.hpp
	Author: Patrick Baggett <ptbaggett@762studios.com>
	Created: 3/6/2013

	Purpose: 

	Reads a binary stream from a SST_File handle. NOTE: On 32-bit platforms, only files up to 4GB are supported.

	License:

	TODO

*/

#pragma once

#ifndef _ZBINARYFILEREADER_HPP
#define _ZBINARYFILEREADER_HPP

#include <SST/SST_File.h>
#include <ZUtil/ZBinaryReader.hpp>

class ZBinaryFileReader : public ZBinaryReader
{
	private:
		SST_File fp;
		size_t Size;
		size_t Offset;

	public:
		ZBinaryFileReader(SST_File handle, SST_ByteOrder bo);

		//Subclass implementation
		uint8_t ReadU8();

		//Subclass implementation
		uint16_t ReadU16();

		//Subclass implementation
		uint32_t ReadU32();

		//Subclass implementation
		uint64_t ReadU64();

		//Subclass implementation
		void ReadU8Array(uint8_t* ptr, size_t count);

		//Subclass implementation
		void ReadU16Array(uint16_t* ptr, size_t count);

		//Subclass implementation
		void ReadU32Array(uint32_t* ptr, size_t count);

		//Subclass implementation
		void ReadU64Array(uint64_t* ptr, size_t count);

		//Subclass implementation
		size_t GetLength() const  { return Size; }

		//Subclass implementation
		size_t GetOffset() const { return Offset; }

		//Subclass implementation
		void SeekTo(size_t offset);

		//Unique to ZBinaryFileReader
		SST_File GetFileHandle() { return fp; }
};

#endif

