
///////////////////////////////////////////////////////////////////////////////
//
// File   : Asura_DebugFileStream.h
// Author : Andy Tate
// Date   : 9-Jun-2005
//
// Copyright (C) 2005 Rebellion, All Rights Reserved.
//
///////////////////////////////////////////////////////////////////////////////

#ifdef ASURA_USE_PRAGMA_ONCE
	#pragma once
#endif   // ifdef ASURA_USE_PRAGMA_ONCE

#ifndef __ASURA_DEBUGFILESTREAM_H__
#define __ASURA_DEBUGFILESTREAM_H__

////////////////////////////////////////////////////////////////////////////////
// Include files...
////////////////////////////////////////////////////////////////////////////////

#include "Core/Asura_Stream.h"
#include "Core/Asura_StringBuffer.h"
#include "FileAccess/Asura_PS3_FileSystem.h"


////////////////////////////////////////////////////////////////////////////////
// Forward class declarations...
////////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////////////////
// Class declaration...
////////////////////////////////////////////////////////////////////////////////

class Asura_DebugFileStream : public Asura_Stream
{
public:
	// Public functions...

	Asura_DebugFileStream          (void)	: m_xHandle(Asura_PS3_FileSystem::INVALID_HANDLE)				{}
	virtual ~Asura_DebugFileStream ()																		{ if (m_bIsOpen) Asura_PS3_FileSystem::Close (&m_xHandle); }

	// File open/close functions...
			bool					Open				(const char* szFilename, const OpenType eOpenType, const bool bUseFullPath);
			bool					OpenForReading		(const char* szFilename, const bool bUseFullPath)	{ return (Open(szFilename, READ_DATA, bUseFullPath)); }
			bool					OpenForWriting		(const char* szFilename, const bool bUseFullPath)	{ return (Open(szFilename, WRITE_DATA, bUseFullPath)); }

	// Virtual functions...
	virtual bool					Open				(const OpenType eOpenType);

	virtual	u_int					ReadData			(const u_int uNumberOfBytes, void* pData);
	virtual	u_int					SkipData			(const u_int uNumberOfBytes);
	virtual	u_int					WriteData			(const u_int uNumberOfBytes, const void* pData);

	virtual	bool					SetCurrentPosition	(u_int uPosition);
	virtual	u_int					GetCurrentPosition	(void) const;

	virtual	u_int					GetFileSize			(void) const;

	virtual	bool					Close				(void);


protected:
	// Protected variables...


	// Protected functions...


private:
	// Private variables...

	// The name of the file to open...
	Asura_String256					m_xFilename;

	// The file handle to be used...
	Asura_PS3_FileSystem::Handle	m_xHandle;

	// are we forcing host0: access?
	bool m_bForceHost0;

	// Private functions...

	Asura_DebugFileStream  (const Asura_DebugFileStream& xOther);

			Asura_DebugFileStream&	operator=		(const Asura_DebugFileStream& xOther);

};   // End of class 'Asura_DebugFileStream'.


#endif   // ifndef __ASURA_DEBUGFILESTREAM_H__


/// End of file. ///
