home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Demos / OOFILE / Buildable, limited OOFILE / OOFILE headers / oofview.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1995-09-24  |  2.0 KB  |  105 lines  |  [TEXT/CWIE]

  1. #ifndef H_OOFVIEW
  2. #define H_OOFVIEW
  3.  
  4. // COPYRIGHT 1994 A.D. Software, All rights reserved
  5.  
  6. // public layer of OOFILE database - database views
  7.  
  8. // NOTE inline definitions included at end of this header file
  9.  
  10. #include "oof1.hpp"
  11.  
  12. class dbSource : public dbClass
  13. {
  14. public:
  15.     virtual ~dbSource() {};
  16.     virtual void start()=0;
  17.     virtual bool more()=0;
  18.     virtual void next()=0;
  19.     virtual unsigned long count()=0;
  20.     virtual bool empty();
  21.     virtual void saveRecord()=0;
  22.     virtual void newRecord()=0;
  23.     virtual dbSource* clone() const=0;
  24.     virtual bool gotoRelativeRecord(unsigned long)=0;
  25. };
  26.  
  27.  
  28.  
  29.  
  30.  
  31. class dbView : public OOF_Dictionary {
  32. public:
  33.     dbView(dbTable*);
  34.     dbView(dbTable&);
  35.     dbView(dbRelRefBase*);
  36.     dbView(dbRelRefBase&);
  37.     dbView(const dbView&);
  38.     const dbView& operator=(const dbView&);
  39.     ~dbView();
  40.  
  41. // shortcut specialised append
  42. // eg: dbView(People) << LastName << Othernames
  43.  
  44.     dbView& append(dbField&);
  45.     dbView& append(dbField*);
  46.     dbView& operator<<(dbField&);    
  47.     dbView& operator<<(dbField*);    
  48.  
  49.     dbSource*    source() const;
  50.     dbField& field(unsigned int);
  51.  
  52. // data storage
  53. private:
  54.     dbSource*    mSource;    // owned
  55. };
  56. ostream& operator<<(ostream& os, dbView& theView);
  57.  
  58.  
  59.  
  60. class dbSourceTable : public dbSource
  61. {
  62. public:
  63.     dbSourceTable(dbTable* tbl) :
  64.                     mTable(tbl) 
  65.     {};
  66.     virtual ~dbSourceTable() {};
  67.     virtual void start();
  68.     virtual bool more();
  69.     virtual void next();
  70.     virtual unsigned long count();
  71.     virtual void saveRecord();
  72.     virtual void newRecord();
  73.     virtual dbSource* clone() const;
  74.     virtual bool gotoRelativeRecord(unsigned long);
  75. private:
  76.     dbTable* mTable;  
  77. };
  78.  
  79.  
  80. class dbSourceRelTable : public dbSource
  81. {
  82. public:
  83.     dbSourceRelTable(dbRelRefBase* tblRef) :
  84.                     mTableRef(tblRef) 
  85.     {};
  86.     virtual ~dbSourceRelTable() {};
  87.     virtual void start();
  88.     virtual bool more();
  89.     virtual void next();
  90.     virtual unsigned long count();
  91.     virtual void saveRecord();
  92.     virtual void newRecord();
  93.     virtual dbSource* clone() const;
  94.     virtual bool gotoRelativeRecord(unsigned long);
  95. private:
  96.     dbRelRefBase* mTableRef;
  97. };
  98.  
  99.  
  100. // include inline definitions
  101. #include "oofview.inl"
  102. #endif
  103.  
  104.  
  105.