home *** CD-ROM | disk | FTP | other *** search
- // Copyright 1994 A.D. Software. All Rights Reserved
-
- // OOFTEST4
-
- // this sample just demonstrates the report-writer
-
- // Simple stream I/O is used to interact with the user.
- #include "oofile.hpp"
- #include "oofrw.hpp"
-
-
- #include "ooftst02.inc"
-
- int main()
- {
- cout << "OOFILE Validation Suite - Test 4\n"
- << "Simple test to demonstrate use of the report-writer" << endl
- << "using the database from ooftest2 and output to a file" << endl;
-
- if (dbConnect::fileExists("ooftst02.db"))
- theDB.openConnection("ooftst02.db");
- else {
- theDB.newConnection("ooftst02.db");
- People.AddTest2Data();
- }
-
- People.sortBy(People.LastName);
- cout << "Listing records to ooftst04.out...";
- ofstream fs("ooftst04.out");
-
- dbView theView(People);
- theView << People.PatientNo << People.LastName << People.Salary;
-
- dbRep tempReport(dbRepSizer("Demo Columnar Report").pageHeight(80),
- dbRepColWidths() << 8 << 10 << 30, theView);
- tempReport.formatForCharStream();
- tempReport.draw(fs);
-
- fs << endl << endl << "Repeating the report with the same data view"<< endl << endl;
-
- dbRep tempReport2(dbRepSizer("Demo Columnar Report").pageHeight(80),
- theView, dbRep::pageWise);
- tempReport2.formatForCharStream();
- tempReport2.draw(fs);
-
- fs.close();
-
- cout << "done" << endl;
-
- return EXIT_SUCCESS;
- }