home *** CD-ROM | disk | FTP | other *** search
- // FILEMGR.H - FileMgr Class Header
-
- #ifndef FILEMGR_H
- #define FILEMGR_H
-
- #include "diskmgr.h"
-
- const moOpen = 1;
- const moClosed = 2;
- const moAlreadyOpen = 3;
-
- const rsDeleted = 1; // Record status
- const rsOK = 0; // Good record
-
- #define HEADSIZ 1024 /* Size of Header record */
-
-
- class FileMgr : public DiskMgr
- {
-
- protected:
-
- char *filename; // Filename of file
- int fd; // File handle of file
- short blocksize; // Size of block
- int recsize; // Size of record (blocksize - 2)lock
-
- int can_close_file; // True if file can be closed
-
- char *contents; // Contents of block
- long cur_rec; // Current record
-
- int create(void);
-
- int head_offset; // How far into the header record before free space
-
- virtual void read_data(void *block) {} // Virtual read function
- virtual void write_data(void *block) {} // Virtual write finction
- virtual void create_file(void) {} // Called by create
-
- void write_head(int rec_status, long next_rec, long recno);
-
- public:
-
- FileMgr(const char *fname, int recsize, int ctype, int mode = moOpen, int file_des = -1);
- ~FileMgr(void);
- int open_file(void);
- void close_file(void);
- void insert(void);
- int amend(void);
- int erase(void);
- int read(long recno);
- int next(void);
- };
-
- #endif
-