proj home

Files   Classes   Functions   Hierarchy  

projfiles.h

Go to the documentation of this file.
00001 #ifndef PROJFILES_H
00002 #define PROJFILES_H
00003 
00004 #include <cassert>
00005 #include <iostream>
00006 #include <string>
00007 using namespace std;
00008 
00009 
00010 #include <compilationfile.h>
00011 #include <makefilebtglobals.h>
00012 #include <systemcalls.h>
00013 
00017 template <typename CFC>
00018 class projfiles
00019 {
00020 public:
00021 
00042   CFC files;
00043 
00045   void construct(stringc & driver_="main");
00046 
00048   string driver;
00049 
00051   stringc drivercpp() const
00052     { return driver + ".cpp"; }
00054   stringc driverh() const
00055     { return driver + ".h"; }
00057   stringc drivero() const
00058     { return driver + ".o"; }
00059 
00060   void print();
00061 
00063   ~projfiles();
00064 };
00065 
00066 
00067 //---------------------------------------------------------
00068 // Implementation
00069 
00070 template <typename CFC>
00071 void projfiles<CFC>::construct(stringc & driver_)
00072 {
00073   driver = driver_;
00074   files.construct(2000);
00075 
00076   systemcalls sys01
00077   (
00078     "find .. -iname \"*.h\"",
00079 //    "tempheaders.txt"
00080     makefilebtglobals::tempheaders
00081   );
00082   sys01.eval();
00083 
00084   systemcalls sys02
00085   (
00086     "find .. -iname \"*.cpp\" | grep -v " + drivercpp(),
00087     "tempcpp.txt"
00088   );
00089   sys02.eval();
00090 
00091   uint linesize;
00092   linesize = sys01.lines.size();
00093   for (uint i=0; i<linesize; ++i)
00094     files.add( new compilationfile(sys01.lines[i]) );
00095   linesize = sys02.lines.size();
00096   for (uint i=0; i<linesize; ++i)
00097     files.add( new compilationfile(sys02.lines[i]) );
00098 
00099   files.add( new compilationfile("./",drivercpp().c_str()) );
00100   // While this file does not exist, it simplifies the logic:
00101   //   rather than treating this cpp file as an exception.
00102   files.add( new compilationfile("./",driverh().c_str()) );
00103 }
00104 
00105 template <typename CFC>
00106 void projfiles<CFC>::print()
00107 {
00108   files.reset();
00109 
00110   compilationfile* x;
00111   for ( ; !files; ++files)
00112   {
00113     x = files();
00114     assert(x);
00115     cout << x->filename << "  " << x->path << endl;
00116   }
00117 }
00118 
00119 template <typename CFC>
00120 projfiles<CFC>::~projfiles()
00121 {
00122   for (files.reset(); !files; ++files)
00123     delete files();
00124 }
00125 
00126 #endif
00127 

Generated on Fri Mar 4 00:49:28 2011 for Chelton Evans Source by  doxygen 1.5.8