/*	FileUtils.h
 *
 *		File utility routines
 */

/*  XT - An example text editor application built with the YAAF library
 *
 *	PUBLIC DOMAIN: The source kit of 'xt' has been placed into the
 *	public domain by the author, William Edward Woody, on the hope
 *	that the source kit will provide a useful example of using the
 *	YAAF Library.
 *  
 *  To contact the author, either e-mail me at woody@pandawave.com, 
 *	or write to
 *  
 *          William Edward Woody
 *          In Phase Consulting
 *          1545 Ard Eevin Avenue
 *          Glendale, CA 91202
 *
 *	Or visit us on the web at http://www.pandawave.com
 */

#ifndef PandaWave_FILEUTILS
#define PandaWave_FILEUTILS

#include <stdio.h>
#include <XHandle.h>

/************************************************************************/
/*																		*/
/*	File I/O Wrapper													*/
/*																		*/
/************************************************************************/

/*	TFile
 *
 *		This wrappers a file reference ID returned by one of the
 *	above OpenProjectXXXX routines. This encapsulates the basic
 *	I/O stuff, but does no caching or anything like that. This just
 *	simplifies my database code by putting all the I/O stuff in one
 *	place...
 */

class TFile {
	public:
								TFile(long refNum);
								
#if OPT_MACOS
								TFile(FSSpec *);
#endif

#if OPT_WINOS || OPT_XWIN
								TFile(char *);
#endif

								~TFile();
		
		/*
		 *	Basic I/O
		 */
		
		bool					IsOpenFile();
		
		long					GetFilePos();
		void					SetFilePos(long);
		
		long					GetEOF();
		void					SetEOF(long);
		
		long					Read(long, void *);
		long					Write(long, const void *);

	private:
		long					fRefNum;
};



#endif // PandaWave_FILEUTILS
