#ifndef INCLUDED_UTILITY_NATIVEASSETFILE
#define INCLUDED_UTILITY_NATIVEASSETFILE

#include <string>

class AAssetManager;
class AAsset;

//////////////////////////////////////////////////////////////
namespace Dubious {
namespace Utility {

class FilePath;
class NativeManager;

/// @brief Provides access to a file asset
///
/// Provides simple read access to a file in the NDK.  This
/// isn't very robust, it's mostly made to get the file into
/// memory as painlessly as possible.  Note that you can not
/// create one of these directly, you must use the NativeManager
class NativeAssetFile
{
public:
	NativeAssetFile( AAssetManager& Manager, const FilePath& Path );

	/// @brief Destructor
	~NativeAssetFile();

	/// @brief Simple read function
	///
	/// This function will read the entire contents of the file
	/// into memory.  It's perfect if you just want to grab a little
	/// xml file, or some other text
	/// @returns The contents of the file in a string
	std::string			Read();

	/// @brief Read a binary file
	///
	/// This read function will read raw bytes into a pre-allocated
	/// character buffer.  This was created to provide access to png
	/// images through the png library.
	/// @param Buffer - [in/out] The buffer that you want to read the
	/// bytes into.  This is allocated before it is passed in, and the
	/// function will not delete it.
	/// @param ByteCount - [in] How many bytes to read
	/// @returns The number of bytes read
	size_t 				Read( unsigned char* Buffer, size_t ByteCount );

private:
	NativeAssetFile( const NativeAssetFile& );
	NativeAssetFile& operator=( const NativeAssetFile& );

	AAsset* 			m_pFile;
};

}
}

#endif
