home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / SKPR115C.ZIP / SKIPPER.H < prev    next >
C/C++ Source or Header  |  1992-03-31  |  3KB  |  111 lines

  1. /*
  2. **
  3. ** "Skipper" Flat File C++ OOP Database System.
  4. **
  5. ** (c)1992 C.A.M. Technical Systems,
  6. **
  7. ** Programmer and System Engineer : C. McNiel.
  8. **
  9. */
  10.  
  11. #define MAXINSERTIONS 20
  12. #define MAXKEYLENGTH 10
  13. #define MAXRECORDSIZE 80
  14. #define DEBUG
  15.  
  16.  
  17. #include <fstream.h>
  18.  
  19.  
  20. #ifndef MAXINSERTIONS
  21.     #error MAXINSERTIONS needs to be defined prior to inclusion.
  22. #endif
  23. #ifndef MAXRECORDSIZE
  24.     #error MAXRECORDSIZE needs to be defined prior to inclusion.
  25. #endif
  26. #ifndef MAXKEYLENGTH
  27.     #error MAXKEYLENGTH needs to be defined prior to inclusion.
  28. #endif
  29.  
  30. extern char *VERRCODE[];
  31.  
  32.  
  33. /*
  34. **    "Class" Definitions.
  35. */
  36.  
  37. #ifdef __DLL__
  38.  
  39. #define Export _export
  40.  
  41. #else
  42.  
  43. #define Export /**/
  44.  
  45. #endif
  46.  
  47.  
  48. class Export Master
  49.  
  50.     {
  51.     private:
  52.  
  53.     unsigned int Dups,AutoAlign,AutoPack;
  54.     unsigned int RecSize;
  55.     unsigned int KeyLen;
  56.     unsigned int KeyOff;    /*  RECORD control variables               */
  57.     fstream HFile;          /*  DataBase Stream                        */
  58.     char FileName[13];
  59.     int ErrState;              /*  Error status of Data Base              */
  60.     int Insertions;         /*  Number of insertions since last pack   */
  61.     unsigned long Records;  /*  Records in database since last pack    */
  62.     unsigned long LastKey;
  63.     int LastOp,Deleteds;    /*  Last database operation  performed     */
  64.     char TempRecord[MAXRECORDSIZE];
  65.  
  66.     int Sort(char *);
  67.  
  68.  
  69.     public:
  70.  
  71.     Master(char *, unsigned int, unsigned int, unsigned int);
  72.  
  73.         int OpenDB(char *, unsigned int, unsigned int, unsigned int);
  74.         int CloseDB(void);
  75.         int Insert(void *);
  76.         int LookUp(char *,void *);
  77.         int CheckInserts(char *,void *);
  78.         int Extract(char *,void *);
  79.         int Delete(char *);
  80.         int Align(void);
  81.         int GetNext(void *);
  82.         int GetPrev(void *);
  83.         int Remove(void);
  84.         int StepNext(void *);
  85.         int StepPrev(void *);
  86.         int Sort_Routine(const void *, const void *);
  87.         int State(void) { return ErrState; };
  88.         int ClearState(void) { return ErrState = 0; }
  89.         int Duplicates(void) { return Dups = 0; }
  90.         int NoDuplicates(void) { return Dups = 1; }
  91.         int AlignOff(void) { return AutoAlign = 1; };
  92.         int AlignOn(void) { return AutoAlign = 0; };
  93.         int PackOff(void) { return AutoPack = 1; };
  94.         int PackOn(void) { return AutoPack = 0; };
  95.         char* Version(void) { return "\nSkipper Version 1.15B\n"; };
  96.         int PackDB(void);
  97.  
  98.         #ifdef DEBUG
  99.  
  100.         char* VERROR(void) { return VERRCODE[ErrState]; };
  101.  
  102.         #endif
  103.  
  104.     ~Master();
  105.  
  106.     };
  107.  
  108. int Srt (const void*,const void*);
  109.  
  110. extern unsigned int KEYLEN,KEYOFF;
  111.