// Copyright 1992 by Jon Dart.  All Rights Reserved.

#ifndef _BOOK_WRITER_H
#define _BOOK_WRITER_H

#include "bookentr.h"
#include <fstream.h>

class Book_Writer
{
	// provides write access to the opening book.

	public:

	Book_Writer( const byte version, const unsigned size );
	// opens book file for writing, truncates any existing file
		
	virtual ~Book_Writer();
	// closes book file
		
	virtual const BOOL Is_Open() const
	{
	   return is_open;
	}
		
	virtual BOOL Write( Book_Entry &be );
	// write a book entry to the file.  Writes are sequential.
		
       private:
	       
       ofstream book_file;
       BOOL is_open;
       unsigned my_size;
       byte my_version;
       unsigned index;
};

#endif
