home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / mslang / isam / include / filemgr.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-08  |  1.3 KB  |  57 lines

  1. // FILEMGR.H - FileMgr Class Header
  2.  
  3. #ifndef FILEMGR_H
  4. #define FILEMGR_H
  5.  
  6. #include "diskmgr.h"
  7.  
  8. const moOpen   = 1;
  9. const moClosed = 2;
  10. const moAlreadyOpen = 3;
  11.  
  12. const rsDeleted = 1; // Record status
  13. const rsOK      = 0; // Good record
  14.  
  15. #define HEADSIZ 1024 /* Size of Header record */
  16.  
  17.  
  18. class FileMgr : public DiskMgr
  19.     {
  20.  
  21. protected:
  22.  
  23.     char *filename; // Filename of file
  24.     int fd; // File handle of file
  25.     short blocksize; // Size of block
  26.     int recsize; // Size of record (blocksize - 2)lock
  27.  
  28.     int can_close_file; // True if file can be closed
  29.  
  30.     char *contents; // Contents of block
  31.     long cur_rec; // Current record
  32.  
  33.     int create(void);
  34.  
  35.     int head_offset; // How far into the header record before free space
  36.  
  37.     virtual void read_data(void *block) {} // Virtual read function
  38.     virtual void write_data(void *block) {} // Virtual write finction
  39.     virtual void create_file(void) {} // Called by create
  40.  
  41.     void write_head(int rec_status, long next_rec, long recno);
  42.  
  43. public:
  44.  
  45.     FileMgr(const char *fname, int recsize, int ctype, int mode = moOpen, int file_des = -1);
  46.     ~FileMgr(void);
  47.     int open_file(void);
  48.     void close_file(void);
  49.     void insert(void);
  50.     int amend(void);
  51.     int erase(void);
  52.     int read(long recno);
  53.     int next(void);
  54.     };
  55.  
  56. #endif
  57.