home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Demos / OOFILE / Buildable, limited OOFILE / samples / ooftst04.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1995-09-27  |  1.3 KB  |  51 lines  |  [TEXT/CWIE]

  1. // Copyright 1994 A.D. Software. All Rights Reserved
  2.  
  3. // OOFTEST4
  4.  
  5. // this sample just demonstrates the report-writer
  6.  
  7. // Simple stream I/O is used to interact with the user.
  8. #include "oofile.hpp"
  9. #include "oofrw.hpp"
  10.  
  11.  
  12. #include "ooftst02.inc"
  13.  
  14. int main()
  15. {
  16.     cout << "OOFILE Validation Suite - Test 4\n"
  17.          << "Simple test to demonstrate use of the report-writer" << endl
  18.          << "using the database from ooftest2 and output to a file" << endl;
  19.  
  20.     if (dbConnect::fileExists("ooftst02.db"))
  21.         theDB.openConnection("ooftst02.db");
  22.     else {
  23.         theDB.newConnection("ooftst02.db");
  24.         People.AddTest2Data();
  25.     }
  26.  
  27.     People.sortBy(People.LastName);
  28.     cout << "Listing records to ooftst04.out...";
  29.     ofstream fs("ooftst04.out");
  30.     
  31.     dbView theView(People); 
  32.     theView << People.PatientNo << People.LastName << People.Salary; 
  33.  
  34.     dbRep tempReport(dbRepSizer("Demo Columnar Report").pageHeight(80),
  35.                     dbRepColWidths() << 8 << 10 << 30, theView);
  36.     tempReport.formatForCharStream();
  37.     tempReport.draw(fs);
  38.  
  39.      fs << endl << endl << "Repeating the report with the same data view"<< endl << endl;
  40.     
  41.     dbRep tempReport2(dbRepSizer("Demo Columnar Report").pageHeight(80),
  42.                      theView, dbRep::pageWise);
  43.     tempReport2.formatForCharStream();
  44.     tempReport2.draw(fs);
  45.  
  46.     fs.close();
  47.     
  48.     cout << "done" << endl;
  49.  
  50.     return EXIT_SUCCESS;
  51. }