proj home

Files   Classes   Functions   Hierarchy  

modulereport Class Reference

Generate report on module. More...

#include <modulereport.h>

Inheritance diagram for modulereport:
Collaboration diagram for modulereport:

List of all members.

Public Member Functions

 modulereport ()
 Does nothing.
boolc reset ()
 Read files into the tokenizers.
int update ()
 Read the generated files and write the report.
int update01 ()
 Basic update test.
void statecalc ()
 Calculate the state.
int compile_exitstatus ()
 Extract from xml the compilers exit status.
int unittests_exitstatus ()
 Extract from xml the unit tests exit status.
stringc compilerhtmldetailed ()
 Extracts from the modules compilers xml file.
stringc unittestshtmldetailed ()
 Extracts from the modules unit tests xml file.
stringc summary01 ()
 Status of module, compilation and unit testing.

Public Attributes

tokenizer ureport
 Read in unit tests report.
tokenizer creport
 Read in compiler report.
bool errorssilent
 If true do not print error messages.
string filepathfront
 Add path to front when accessing files.

Static Public Attributes

static string fileout_html = "modulereport.html"
 html file output.


Detailed Description

Generate report on module.

Document view architecture.

Assumes in the proj/xxx directory.

Definition at line 44 of file modulereport.h.


Constructor & Destructor Documentation

modulereport::modulereport (  ) 

Does nothing.

Definition at line 92 of file modulereport.cpp.

00093   : errorssilent(false)
00094 {
00095 }


Member Function Documentation

int modulereport::compile_exitstatus (  ) 

Extract from xml the compilers exit status.

Definition at line 138 of file modulereport.cpp.

References creport, tokenizerlocal::read(), tokenizer::reset(), and stringfrom().

Referenced by statecalc(), summary01(), and update01().

00139 {
00140   tokenizerlocal tkl(creport);
00141   string s1;
00142   creport.reset();
00143   bool res=true;
00144   res &= tkl.read(s1,"exitstatus");
00145 //cout << SHOW(res) << " " << SHOW(s1) << endl;
00146 
00147   int exitstatus=1;
00148   stringfrom(exitstatus,s1);
00149 
00150   return exitstatus;
00151 }

stringc modulereport::compilerhtmldetailed (  ) 

Extracts from the modules compilers xml file.

Definition at line 183 of file modulereport.cpp.

References creport, tokenizerlocal::read(), tokenizerlocal::reset(), htmlstring::serializeInverse(), and stringtag().

Referenced by update().

00184 {
00185 // id: 
00186 // compilertag id
00187 // command:
00188 // compilertag command
00189 // libraries: 
00190 // compilertag libraries
00191 
00192 // time: time
00193 
00194 // head
00195 // output in <pre> tags.
00196 
00197   tokenizerlocal tkl(creport);
00198   string s1;
00199   string s0; 
00200 
00201   //tkl.reset_start=true;
00202 
00203   //s0 += "<h2>Compilation</h2>\n";
00204 
00205   s0 += "<p>\n";
00206 
00207   tkl.reset();
00208   if (tkl.read(s1,"compiletag","id"))
00209     s0 += ("id: " + s1 + "<br />\n");
00210 /*
00211   {
00212     s0 += ("id: " + s1 + "<br />");
00213   }
00214 */
00215 
00216 /*
00217   tkl.reset();
00218   bool res=tkl.read(s1,"compiletag","command");
00219 cout << SHOW(res) << endl;
00220 tkl.ref.printdelimiter="*\n";
00221 cout << tkl.ref << endl;
00222 */
00223 /*
00224   if (tkl.read(s1,"compiletag","command"))
00225   {
00226     s0 += ("command: " + s1 + "<br />");
00227   }
00228 */
00229 
00230   tkl.reset();
00231   if (tkl.read(s1,"compiletag","command"))
00232     s0 += ("command: " + s1 + "<br />\n");
00233 
00234   tkl.reset();
00235   if (tkl.read(s1,"compiletag","libraries"))
00236     s0 += ("libraries: " + s1 + "<br />\n");
00237 
00238   tkl.reset();
00239   if (tkl.read(s1,"time"))
00240     s0 += ("time: " + s1 + "\n</p>\n");
00241 
00242   tkl.reset();
00243   if (tkl.read(s1,"head"))
00244   {
00245     string s2;
00246     htmlstring::serializeInverse(s2,s1);
00247     s0 += stringtag(s2,"pre");
00248   }
00249 
00250   s0 += "\n";
00251 
00252   return s0;
00253 }

boolc modulereport::reset (  ) 

Read files into the tokenizers.

Definition at line 61 of file modulereport.cpp.

References creport, errorssilent, mkerrorscompile::fileout_txt, filepathfront, projunittests::fileresults, tokenizer::read(), tokenizer::seq, filestring::serialize(), and ureport.

Referenced by update(), and update01().

00062 {
00063   bool res=true;
00064 
00065   ureport.seq.clear();
00066   string unittestsreport;
00067   string file1=filepathfront+projunittests::fileresults;
00068   if (!filestring::serialize(unittestsreport,file1))
00069   {
00070     res=false;
00071 
00072     if (!errorssilent)
00073       cout << "error:  could not read file " << file1 << endl;
00074   }
00075   ureport.read(unittestsreport);
00076   
00077   creport.seq.clear();
00078   string compilationreport;
00079   string file2=filepathfront+mkerrorscompile::fileout_txt;
00080   if (!filestring::serialize(compilationreport,file2))
00081   {
00082     res=false;
00083 
00084     if (!errorssilent)
00085       cout << "error:  could not read file " << file2 << endl;
00086   }
00087   creport.read(compilationreport);
00088 
00089   return res;
00090 }

void modulereport::statecalc (  ) 

Calculate the state.

Definition at line 153 of file modulereport.cpp.

References modulestate::amber, compile_exitstatus(), modulestate::green, modulestate::red, modulestate::state, and unittests_exitstatus().

Referenced by update(), and update01().

00154 {
00155   int compilestatus=compile_exitstatus();
00156   int unittestsstatus=unittests_exitstatus();
00157 
00158   state=red;
00159 
00160   if ((compilestatus==0)&&(unittestsstatus==0))
00161     state=green;
00162   if ((compilestatus==0)&&(unittestsstatus!=0))
00163     state=amber;
00164 }

stringc modulereport::summary01 (  ) 

Status of module, compilation and unit testing.

Definition at line 371 of file modulereport.cpp.

References compile_exitstatus(), modulestate::statestring(), and unittests_exitstatus().

Referenced by update().

00372 {
00373   string s1;
00374   s1 += "<p>Module Status &nbsp; ";
00375   s1 += (statestring() + "<br />");
00376   
00377   s1 += "Compilation Status &nbsp; ";
00378   s1 += (exitint( compile_exitstatus() ).isvalidtext() + "<br />");
00379 
00380   s1 += "Unit Tests &nbsp; ";
00381   s1 += (exitint( unittests_exitstatus() ).isvalidtext() );
00382 
00383   s1 += "</p>";
00384 
00385   return s1;
00386 }

int modulereport::unittests_exitstatus (  ) 

Extract from xml the unit tests exit status.

Definition at line 123 of file modulereport.cpp.

References tokenizerlocal::read(), tokenizer::reset(), stringfrom(), and ureport.

Referenced by statecalc(), summary01(), and update01().

00124 {
00125   tokenizerlocal tkl(ureport);
00126   string s1;
00127   ureport.reset();
00128 
00129   int exitstatus=1;
00130   if (tkl.read(s1,"status","exitstatus")==false)
00131     return exitstatus;
00132 
00133   stringfrom(exitstatus,s1);
00134 
00135   return exitstatus;
00136 }

stringc modulereport::unittestshtmldetailed (  ) 

Extracts from the modules unit tests xml file.

Definition at line 270 of file modulereport.cpp.

References tokenizerlocal::boundscope(), tokenizerlocal::read(), tokenizerlocal::scope(), htmlstring::serializeInverse(), stringtag(), and ureport.

Referenced by update().

00271 {
00272   string s0;
00273 //  string s0="<h2>Unit tests</h2>";
00274 //cout << "modulereport::unittestshtmldetailed()" << endl;
00275 
00276   string exitstatus;
00277   string file;
00278 
00279   tokenizerlocal tl1(ureport);
00280   tl1.boundscope("vi");
00281 
00282   string s1;
00283 
00284   tokenizerlocal tl2(tl1);
00285   for ( ; tl2.scope("unittest"); ++tl2)
00286   {
00287     tokenizerlocal tl3(tl2);
00288     if (tl3.read(exitstatus,"exitstatus")==false)
00289       continue;
00290 // cout << SHOW3(exitstatus) << endl;
00291     if (tl3.read(file,"file")==false)
00292       continue;
00293 // cout << SHOW3(file) << endl;
00294 
00295     s1 += ("<p>exitstatus: "+exitstatus);
00296     s1 += "<br />";
00297     s1 += ("file: " + file);
00298     s1 += "</p>";
00299    
00300     s0 += s1;
00301 
00302     s1.clear();
00303 
00304     if (tl3.scope("commandlines")==false)
00305       continue;
00306 
00307     tokenizerlocal tl4(tl3);
00308     for ( ; tl4.scope("cmd"); ++tl4)
00309     {
00310       tokenizerlocal tl5(tl4);
00311       string exitstatus;
00312       if (tl5.read(exitstatus,"exitstatus")==false)
00313         continue;
00314       string line;
00315       if (tl5.read(line,"line")==false)
00316         continue;
00317       string output;
00318       if (tl5.read(output,"output")==false)
00319         continue;
00320 
00321       //cout << SHOW3(exitstatus) << endl;
00322       //cout << SHOW3(line) << endl;
00323       //cout << SHOW3(output) << endl;
00324 
00325       s1 += ("<p>exitstatus: " + exitstatus);
00326       s1 += "<br />";
00327       s1 += ("line: " + line);
00328       s1 += "</p>\n";
00329       {
00330         string output2;
00331         htmlstring::serializeInverse(output2,output);
00332         s1 += (stringtag(output2,"pre")+"\n");
00333       }
00334       //s1 += ("<pre>"+output+"</pre>\n");
00335     }
00336 //    s1 += "</p>";
00337 
00338     s0 += s1;
00339   }
00340 
00341 //cout << SHOW3(exitstatus) << endl;
00342   
00343   return s0;
00344 }

int modulereport::update (  ) 

Read the generated files and write the report.

Definition at line 388 of file modulereport.cpp.

References compilerhtmldetailed(), fileout_html, modulestate::htmlimg(), reset(), filestring::serializeInverse(), statecalc(), stringtag(), summary01(), and unittestshtmldetailed().

Referenced by mkerrorstest::test05().

00389 {
00390   reset();
00391   statecalc();
00392 
00393   string s1="\n";
00394   s1 += "<h1>Module Report";
00395   s1 += htmlimg("../"); 
00396   s1 += "</h1>\n";
00397 
00398   s1 += (summary01()+"\n");
00399 
00400   s1 += "<h2>Compilation</h2>\n";
00401   s1 += compilerhtmldetailed();
00402   s1 += "<h2>Unit tests</h2>\n";
00403   s1 += unittestshtmldetailed();
00404 
00405   string s2 = stringtag(s1,"body");
00406   string s3 = stringtag(s2,"html");
00407 
00408   
00409   filestring::serializeInverse(fileout_html,s3);
00410 
00411   return 0;
00412 }

int modulereport::update01 (  ) 

Basic update test.

Definition at line 27 of file modulereport.cpp.

References compile_exitstatus(), fileout_html, modulestate::htmlimg(), reset(), filestring::serializeInverse(), statecalc(), modulestate::statestring(), stringtag(), and unittests_exitstatus().

Referenced by mkerrorstest::test04().

00028 {
00029   reset();
00030   statecalc();
00031 
00032   string s1="\n";
00033   s1 += "<h1>Module Report";
00034   s1 += htmlimg("../"); 
00035   s1 += "</h1>\n";
00036 
00037 // Spec
00038 // Module Status  Failure
00039 // Compilation Status  Success
00040 // Unit Tests  Failure
00041 
00042   s1 += "Module Status &nbsp; ";
00043   s1 += (statestring() + "<br />");
00044   
00045   s1 += "Compilation Status &nbsp; ";
00046   s1 += (exitint( compile_exitstatus() ).isvalidtext() + "<br />");
00047 
00048 
00049   s1 += "Unit Tests &nbsp; ";
00050   s1 += (exitint( unittests_exitstatus() ).isvalidtext() + "<br />");
00051 
00052 
00053   string s2 = stringtag(s1,"body");
00054   string s3 = stringtag(s2,"html");
00055 
00056   filestring::serializeInverse(fileout_html,s3);
00057 
00058   return 0;
00059 }


Member Data Documentation

Read in compiler report.

Definition at line 57 of file modulereport.h.

Referenced by compile_exitstatus(), compilerhtmldetailed(), and reset().

If true do not print error messages.

Definition at line 60 of file modulereport.h.

Referenced by reset().

string modulereport::fileout_html = "modulereport.html" [static]

html file output.

Definition at line 49 of file modulereport.h.

Referenced by update(), and update01().

Add path to front when accessing files.

Definition at line 63 of file modulereport.h.

Referenced by reset(), and cireport::reset().

Read in unit tests report.

Definition at line 55 of file modulereport.h.

Referenced by reset(), unittests_exitstatus(), and unittestshtmldetailed().


The documentation for this class was generated from the following files:

Generated on Fri Mar 4 00:50:07 2011 for Chelton Evans Source by  doxygen 1.5.8