home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / db02_src.zip / idxinfo.h < prev    next >
C/C++ Source or Header  |  1993-11-05  |  4KB  |  172 lines

  1. /**************************************************************************
  2.  * Source Id :
  3.  *
  4.  * $Id: idxinfo.h,v 1.10 1993/10/18 11:35:01 kevinl Exp $
  5.  *-------------------------------------------------------------------------
  6.  * Project Notes :
  7.  *
  8.  *  Diamond Base
  9.  *  ============
  10.  *      A solid database implementation, spurred on by the continuing
  11.  *  Metal (Lead) Base saga.
  12.  *
  13.  *  Project Team :
  14.  *        A. Davison
  15.  *        K. Lentin
  16.  *        D. Platt
  17.  *
  18.  *    Project Commenced : 05-02-1993
  19.  *
  20.  *-------------------------------------------------------------------------
  21.  *  Module Notes :
  22.  *
  23.  *  Index/Field Information Headers.
  24.  *
  25.  *
  26.  *  Original Author : Andy
  27.  *
  28.  *-------------------------------------------------------------------------
  29.  * Revision History:
  30.  *
  31.  * $Log: idxinfo.h,v $
  32.  * Revision 1.10  1993/10/18  11:35:01  kevinl
  33.  * Added number()
  34.  *
  35.  * Revision 1.9  1993/05/03  01:35:37  kevinl
  36.  * Got rid of externs on the consts
  37.  *
  38.  * Revision 1.8  1993/04/28  11:31:09  kevinl
  39.  * Fixed up inlines
  40.  *
  41.  * Revision 1.7  1993/04/27  07:00:19  kevinl
  42.  * Comments
  43.  *
  44.  * Revision 1.6  1993/04/15  06:06:38  davison
  45.  * Fixed up inline not expanded errors etc
  46.  *
  47.  * Revision 1.5  1993/04/15  04:21:52  kevinl
  48.  * Moved malloc.h
  49.  *
  50.  * Revision 1.4  1993/03/21  01:15:33  davison
  51.  * Ooops. Fixed that last one proper like now ...
  52.  *
  53.  * Revision 1.3  1993/03/21  01:02:11  davison
  54.  * Made a couple of const's #defines.
  55.  *
  56.  * Revision 1.2  1993/03/15  19:24:05  davison
  57.  * Implemented a few nice things, like more than 2 index fields, line number
  58.  * reporting on syntax errors, and usage reporting.
  59.  *
  60.  * Just for you, Daz :-)
  61.  *
  62.  * Revision 1.1  1993/03/15  19:22:53  davison
  63.  * Initial revision
  64.  *
  65.  **************************************************************************/
  66. #ifndef __IDX_DEFINITIONS__
  67. #define __IDX_DEFINITIONS__
  68.  
  69. #include <string.h>
  70. #include <iostream.h>
  71. #include <fstream.h>
  72.  
  73. const int IDX_SINGLE        = 0x01;
  74. const int IDX_MULTIPLE      = 0x02;
  75. const int IDX_FIRST         = 0x04;
  76. const int IDX_SECOND        = 0x08;
  77. const int IDX_DUPLICATES    = 0x10;
  78. const int IDX_NODUPLICATES  = 0x20;
  79.  
  80. const int IDX_INFO_MAGIC    = 0xFEED;
  81. const int IDX_LIST_MAGIC    = 0x1DEA;
  82. const int FLD_LIST_MAGIC    = 0xBEAD;
  83. const int FLD_INFO_MAGIC    = 0xBABE;
  84.  
  85. const int MAX_FIELDS_IN_INDEX = 10;
  86. const int MAX_NAME_LENGTH = 300;
  87.  
  88. //---- Misc rountines...
  89.  
  90. void checkStream(ifstream&);
  91. void checkStream(ofstream&);
  92.  
  93. typedef int TIndicies[MAX_FIELDS_IN_INDEX];
  94. struct indexInfo
  95. {
  96.     int            idxType;
  97.     int            idxFields[MAX_FIELDS_IN_INDEX];
  98.     indexInfo*    nextIdx;
  99.  
  100.     // Moved the definition of the constructor into the .cc file
  101.     // to stop complaints about it not getting expanded inline.
  102.  
  103.     indexInfo(int type, TIndicies indicies ); 
  104. /*    {
  105.         idxType = type;
  106.         for(int i=0;i<MAX_FIELDS_IN_INDEX;i++)
  107.         {
  108.             idxFields[i] = indicies[i];
  109.         }
  110.         nextIdx = 0;
  111.     }
  112. */
  113.     ~indexInfo();
  114. friend ostream& operator << (ostream&, indexInfo&);
  115. friend ofstream& operator << (ofstream&, indexInfo&);
  116. };
  117.  
  118. // Holds the list of indicies
  119. struct indexList
  120. {
  121.     int            numIndicies;
  122.     indexInfo*    indicies;
  123.  
  124.     indexList() {numIndicies = 0; indicies = 0;}
  125.     ~indexList()
  126.     {
  127.         delete indicies;
  128.     }
  129.     long number(char* name);
  130.  
  131. friend ostream& operator << (ostream&, indexList&);
  132. friend ofstream& operator << (ofstream&, indexList&);
  133. friend ifstream& operator >> (ifstream&, indexList&);
  134.  
  135. };
  136.  
  137.  
  138. // Holds the info on a field
  139. struct fieldInfo
  140. {
  141.     int            fldType;
  142.     int            fldSize;
  143.     char*        fldName;
  144.     fieldInfo*    nextFld;
  145.  
  146.     fieldInfo(char* name, int ty, int sz);
  147.     ~fieldInfo();
  148. friend ostream& operator << (ostream&, fieldInfo&);
  149. friend ofstream& operator << (ofstream&, fieldInfo&);
  150.  
  151. };
  152.  
  153. // Holds the list of fields
  154.  
  155. struct fieldList
  156. {
  157.     int        numFields;
  158.     fieldInfo*    fields;
  159.     fieldList() {fields = 0; numFields = 0;}
  160.  
  161.     ~fieldList()
  162.     {
  163.         delete fields;
  164.     }
  165. friend ostream& operator << (ostream&, fieldList&);
  166. friend ofstream& operator << (ofstream&, fieldList&);
  167. friend ifstream& operator >> (ifstream&, fieldList&);
  168.  
  169. };
  170.  
  171. #endif
  172.