/****************************************************************************************************

		IMCLargeFile.h
		Copyright: (c) 2001 Eovia Corp. All rights reserved.

		Author:	Pierre-Sylvain
		Date:	3/23/2006

****************************************************************************************************/

#ifndef __IMCLargeFile__
#define __IMCLargeFile__

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include "MCCompObj.h"
#include "MCBasicDefines.h"
#include "MCBasicTypes.h"
#include "MCDateTime.h"


class TMCString;

//*********************** Globally Unique Ids ********************************
MCDEFINE_GUID_H(IID_IMCLargeFile);


/// \addtogroup MCCore
/// \{

/// IMCLargeFile is the interface to access a file that can be larger than 2 Go.
///
/// To create an IMCLargeFile, use  IShFileUtilities::CreateIMCLargeFile():
///
/// \code
///
/// TMCCountedPtr<IMCLargeFile> file;
/// gFileUtilities->CreateIMCLargeFile(&file);
///
/// \endcode
///
struct IMCLargeFile : public IMCUnknown
{
	// ****************************************************************************
	//								SetWithIMCFile
	// 
	/// Sets the file path and permission from another file.
	/// 
	/// \param aFile  The file from which we get the path.
	/// 
	virtual MCErr	MCCOMAPI SetWithIMCFile(const IMCFile& aFile) = 0;

	// ****************************************************************************
	//								GetIMCFile
	// 
	/// Creates an IMCFile with the same path name.
	/// 
	/// \param aFile  Returned file.
	/// 
	virtual MCErr	MCCOMAPI GetIMCFile(IMCFile** aFile) = 0;

	// ****************************************************************************
	//								GetSize
	// 
	/// Returns the size of the file.
	/// 
	/// \param length  The size of the file.
	/// 
	virtual MCErr	MCCOMAPI GetSize				(uint64& length) = 0;	

	// ****************************************************************************
	//								GetPosition
	// 
	/// Returns the current position in the file.
	/// 
	/// \param mark  The position.
	/// 
	virtual MCErr	MCCOMAPI GetPosition			(uint64& mark) = 0;
	
	// ****************************************************************************
	//								Open
	// 
	/// Opens a file using the permissions specified in SetPermissions
	/// 
	/// Note: When opening the file to write, the file size is not reset to 0. You
	/// need to call SetEOF for that purpose.
	/// 
	virtual MCErr	MCCOMAPI Open					() = 0;
	
	// ****************************************************************************
	//								Close
	// 
	/// Closes the file.
	/// 
	virtual MCErr	MCCOMAPI Close					(void) = 0;
	
	// ****************************************************************************
	//								Flush
	// 
	/// Writes all the data to the disk.
	/// 
	virtual MCErr	MCCOMAPI Flush					(void) = 0;
	
	virtual MCErr	MCCOMAPI Read					(void* buffer, uint32 readAmount, uint32* bytesRead=nil) = 0;
	virtual MCErr	MCCOMAPI Write					(const void* buffer, uint32 writeAmount, uint32* bytesWritten=nil) = 0;
	virtual MCErr	MCCOMAPI Seek					(int64 distance, IMCFile::EFileSeekType startPoint) = 0;	 
	virtual MCErr	MCCOMAPI SetEOF					(uint64 newLength) = 0;  
};

/// \}



#endif
