CCCC - C and C++ Code Counter  9999-git
CCCC Development version (post-3.1.4)
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
CCCC_Html_Stream Class Reference

#include <cccc_htm.h>

Collaboration diagram for CCCC_Html_Stream:
[legend]

Public Member Functions

 CCCC_Html_Stream (const string &fname, const string &info)
 
 ~CCCC_Html_Stream ()
 

Static Public Member Functions

static void GenerateReports (CCCC_Project *project, int report_mask, const string &outfile, const string &outdir)
 

Private Member Functions

void Table_Of_Contents (int report_mask, bool showGenTime)
 
void Project_Summary ()
 
void Procedural_Summary ()
 
void Procedural_Detail ()
 
void Structural_Summary ()
 
void Structural_Detail ()
 
void OO_Design ()
 
void Other_Extents ()
 
void Separate_Modules ()
 
void Source_Listing ()
 
void Module_Summary (CCCC_Module *module_ptr)
 
void Module_Detail (CCCC_Module *module_ptr)
 
void Procedural_Detail (CCCC_Module *module_ptr)
 
void Structural_Detail (CCCC_Module *module_ptr)
 
void Separate_Module_Link (CCCC_Module *module_ptr)
 
void Put_Section_Heading (string section_name, string section_tag, int section_level)
 
void Put_Section_TOC_Entry (string section_name, string section_href, string section_description)
 
void Put_Header_Cell (string label, int width=0)
 
void Put_Label_Cell (string label, int width=0, string ref_name="", string ref_href="", CCCC_Record *rec_ptr=0)
 
void Put_Metric_Cell (const CCCC_Metric &metric, int width=0)
 
void Put_Metric_Cell (int count, string tag, int width=0)
 
void Put_Metric_Cell (int num, int denom, string tag, int width=0)
 
void Put_Extent_URL (const CCCC_Extent &extent)
 
void Put_Extent_Cell (const CCCC_Extent &extent, int width=0, bool withDescription=false)
 
void Put_Extent_List (CCCC_Record &record, bool withDescription=false)
 
void Put_Structural_Details_Cell (CCCC_Module *mod, CCCC_Project *prj, int mask, UserelNameLevel nl)
 
void Metric_Description (string abbreviation, string name, string description)
 

Private Attributes

ofstream fstr
 

Static Private Attributes

static string libdir
 
static string outdir
 
static CCCC_Projectprjptr
 

Friends

CCCC_Html_Streamoperator<< (CCCC_Html_Stream &os, const string &stg)
 
CCCC_Html_Streamoperator<< (CCCC_Html_Stream &os, const CCCC_Metric &mtc)
 

Detailed Description

Definition at line 44 of file cccc_htm.h.

Constructor & Destructor Documentation

CCCC_Html_Stream::CCCC_Html_Stream ( const string &  fname,
const string &  info 
)

Definition at line 1343 of file cccc_htm.cc.

1344 {
1345  // cerr << "Attempting to open file in directory " << outdir.c_str() << endl;
1346  fstr.open(fname.c_str());
1347  if(fstr.good() != TRUE)
1348  {
1349  cerr << "failed to open " << fname.c_str()
1350  << " for output in directory " << outdir.c_str() << endl;
1351  exit(1);
1352  }
1353  else
1354  {
1355  // cerr << "File: " << fname << " Info: " << info << endl;
1356  }
1357 
1358  fstr << "<HTML><HEAD><TITLE>" << endl
1359  << info << endl
1360  << "</TITLE>" << endl
1361  << "</HEAD>" << endl
1362  << "<BODY>" << endl;
1363 }
static string outdir
Definition: cccc_htm.h:52
ofstream fstr
Definition: cccc_htm.h:50
CCCC_Html_Stream::~CCCC_Html_Stream ( )

Definition at line 148 of file cccc_htm.cc.

149 {
150  fstr << "</BODY></HTML>" << endl;
151  fstr.close();
152 }
ofstream fstr
Definition: cccc_htm.h:50

Member Function Documentation

void CCCC_Html_Stream::GenerateReports ( CCCC_Project project,
int  report_mask,
const string &  outfile,
const string &  outdir 
)
static

Definition at line 55 of file cccc_htm.cc.

59 {
60  prjptr=prj;
61  outdir=dir;
62 
63  CCCC_Html_Stream main_html_stream(file.c_str(),"Report on software metrics");
64 
65  if(report_mask & rtCONTENTS)
66  {
67  // For testing purposes, we want to be able to disable the inclusion
68  // of the current time in the report. This enables us to store a
69  // reference version of the report in RCS and expect the program
70  // to generate an identical one at regression testing time.
71  if(report_mask & rtSHOW_GEN_TIME)
72  {
73  main_html_stream.Table_Of_Contents(report_mask,true);
74  }
75  else
76  {
77  main_html_stream.Table_Of_Contents(report_mask,false);
78  }
79  }
80 
81  if(report_mask & rtSUMMARY)
82  {
83  main_html_stream.Project_Summary();
84  }
85 
86  if(report_mask & rtPROC1)
87  {
88  main_html_stream.Procedural_Summary();
89  }
90 
91  if(report_mask & rtPROC2)
92  {
93  main_html_stream.Procedural_Detail();
94  }
95 
96  if(report_mask & rtOODESIGN)
97  {
98  main_html_stream.OO_Design();
99  }
100 
101  if(report_mask & rtSTRUCT1)
102  {
103  main_html_stream.Structural_Summary();
104  }
105 
106  if(report_mask & rtSTRUCT2)
107  {
108  main_html_stream.Structural_Detail();
109  }
110 
111  if(report_mask & rtSEPARATE_MODULES)
112  {
113  main_html_stream.Separate_Modules();
114  }
115 
116  if(report_mask & rtOTHER)
117  {
118  main_html_stream.Other_Extents();
119  }
120 
121  if(report_mask & rtSOURCE)
122  {
123  main_html_stream.Source_Listing();
124  }
125 
126 
127  if(report_mask & rtCCCC)
128  {
129  main_html_stream.Put_Section_Heading("About CCCC","infocccc",1);
130  main_html_stream.fstr
131  << "<P>This report was generated by the program CCCC, which is FREELY "
132  << "REDISTRIBUTABLE but carries NO WARRANTY." << endl
133  << "<P>CCCC was developed by Tim Littlefair. " << endl
134  << "as part of a PhD research project. "
135  << "This project is now completed and descriptions of the "
136  << "findings can be accessed at "
137  << "<A HREF=http://www.chs.ecu.edu.au/~tlittlef>"
138  << "http://www.chs.ecu.edu.au/~tlittlef</A>. "
139  << "<P>User support for CCCC can be obtained by "
140  << "<A HREF=mailto:cccc-users@lists.sourceforge.net>"
141  << "mailing the list cccc-users@lists.sourceforge.net</A>."
142  << "<P>Please also visit the new CCCC development website at "
143  << "<A HREF=http://sarnold.github.io/cccc/>http://sarnold.github.io/cccc/</A>."
144  << endl;
145  }
146 }
void Table_Of_Contents(int report_mask, bool showGenTime)
Definition: cccc_htm.cc:154
static CCCC_Project * prjptr
Definition: cccc_htm.h:53
CCCC_Project * prj
Definition: ccccmain.cc:49
static string outdir
Definition: cccc_htm.h:52

Here is the call graph for this function:

Here is the caller graph for this function:

void CCCC_Html_Stream::Metric_Description ( string  abbreviation,
string  name,
string  description 
)
private

Definition at line 1204 of file cccc_htm.cc.

1208 {
1209  // this is intended to be called in the context of an unnumbered list
1210  fstr << "<LI>" << abbreviation << " = " << name << "<BR>" << endl
1211  << description << endl;
1212 }
ofstream fstr
Definition: cccc_htm.h:50

Here is the caller graph for this function:

void CCCC_Html_Stream::Module_Detail ( CCCC_Module module_ptr)
private

Definition at line 1105 of file cccc_htm.cc.

1106 {
1107  // this function generates the contents of the table of definition
1108  // and declaration extents for a single module
1109 
1110  // the output needs to be enveloped in a pair of <TABLE></TABLE> tags
1111  // these have not been put within the function because it is designed
1112  // to be used in two contexts:
1113  // 1. within the Separate_Modules function, wrapped directly in the table
1114  // tags
1115  // 2. within the Module_Detail function, where the table tags are
1116  // around the output of many calls to this function (not yet implemented)
1117 
1118  CCCC_Record::Extent_Table::iterator eIter = module_ptr->extent_table.begin();
1119  if(eIter==module_ptr->extent_table.end())
1120  {
1121  fstr << "<TR><TD COLSPAN=6>"
1122  << "No module extents have been identified for this module"
1123  << "</TD></TR>" << endl;
1124  }
1125  else
1126  {
1127  while(eIter!=module_ptr->extent_table.end())
1128  {
1129  CCCC_Extent *ext_ptr=(*eIter).second;
1130  fstr << "<TR>" << endl;
1131  Put_Extent_Cell(*ext_ptr,0,true);
1132  int loc=ext_ptr->get_count("LOC");
1133  int mvg=ext_ptr->get_count("MVG");
1134  int com=ext_ptr->get_count("COM");
1135  CCCC_Metric mloc(loc,"LOCf");
1136  CCCC_Metric mmvg(mvg,"MVGf");
1137  CCCC_Metric ml_c(loc,com,"L_C");
1138  CCCC_Metric mm_c(mvg,com,"M_C");
1139 
1140  Put_Metric_Cell(mloc);
1141  Put_Metric_Cell(mmvg);
1142  Put_Metric_Cell(com);
1143  Put_Metric_Cell(ml_c);
1144  Put_Metric_Cell(mm_c);
1145  fstr << "</TR>" << endl;
1146 
1147  eIter++;
1148  }
1149  }
1150 
1151  fstr << "<TR><TD HEIGHT=12 COLSPAN=6></TD></TR>" << endl;
1152 }
int get_count(const char *count_tag)
Definition: cccc_ext.cc:147
void Put_Metric_Cell(const CCCC_Metric &metric, int width=0)
Definition: cccc_htm.cc:919
Extent_Table extent_table
Definition: cccc_rec.h:45
ofstream fstr
Definition: cccc_htm.h:50
void Put_Extent_Cell(const CCCC_Extent &extent, int width=0, bool withDescription=false)
Definition: cccc_htm.cc:962

Here is the call graph for this function:

void CCCC_Html_Stream::Module_Summary ( CCCC_Module module_ptr)
private

Definition at line 1220 of file cccc_htm.cc.

1221 {
1222  // calculate the counts on which all displayed data will be based
1223  // int nof=module_ptr->member_table.records(); // Number of functions
1224  int nof=0;
1225  int loc=module_ptr->get_count("LOC"); // lines of code
1226  int mvg=module_ptr->get_count("MVG"); // McCabes cyclomatic complexity
1227  int com=module_ptr->get_count("COM"); // lines of comment
1228 
1229  // the variants of IF4 measure information flow and couplings
1230  int if4=module_ptr->get_count("IF4"); // (all couplings)
1231  int if4v=module_ptr->get_count("IF4v"); // (visible only)
1232  int if4c=module_ptr->get_count("IF4c"); // (concrete only)
1233 
1234  int wmc1=module_ptr->get_count("WMC1"); // Weighted methods/class (unity)
1235  int wmcv=module_ptr->get_count("WMCv"); // Weighted methods/class (visible)
1236  int dit=module_ptr->get_count("DIT"); // depth of inheritance tree
1237  int noc=module_ptr->get_count("NOC"); // number of children
1238  int cbo=module_ptr->get_count("CBO"); // coupling between objects
1239 
1240  fstr << "<TABLE BORDER WIDTH=100%>" << endl
1241  << "<TR>" << endl;
1242  Put_Header_Cell("Metric",70);
1243  Put_Header_Cell("Tag",10);
1244  Put_Header_Cell("Overall",10);
1245  Put_Header_Cell("Per Function",10);
1246  fstr << "</TR>" << endl;
1247 
1248  fstr << "<TR>" << endl;
1249  Put_Label_Cell("Lines of Code");
1250  Put_Label_Cell("LOC");
1251  Put_Metric_Cell(loc,"LOCm");
1252  Put_Metric_Cell(loc,nof,"LOCg");
1253  fstr << "</TR>" << endl;
1254 
1255  fstr << "<TR>" << endl;
1256  Put_Label_Cell("McCabe's Cyclomatic Number");
1257  Put_Label_Cell("MVG");
1258  Put_Metric_Cell(mvg,"MVGm");
1259  Put_Metric_Cell(mvg,nof,"MVGf");
1260  fstr << "</TR>" << endl;
1261 
1262  fstr << "<TR>" << endl;
1263  Put_Label_Cell("Lines of Comment");
1264  Put_Label_Cell("COM");
1265  Put_Metric_Cell(com,"COMm");
1266  Put_Metric_Cell(com,nof,"8.3");
1267  fstr << "</TR>" << endl;
1268 
1269  fstr << "<TR>" << endl;
1270  Put_Label_Cell("LOC/COM");
1271  Put_Label_Cell("L_C");
1272  Put_Metric_Cell(loc,com,"L_C");
1273  Put_Label_Cell("");
1274  fstr << "</TR>" << endl;
1275 
1276  fstr << "<TR>" << endl;
1277  Put_Label_Cell("MVG/COM");
1278  Put_Label_Cell("M_C");
1279  Put_Metric_Cell(mvg,com,"M_C");
1280  Put_Label_Cell("");
1281  fstr << "</TR>" << endl;
1282 
1283  fstr << "<TR>" << endl;
1284  Put_Label_Cell("Weighted Methods per Class (weighting = unity)");
1285  Put_Label_Cell("WMC1");
1286  Put_Metric_Cell(wmc1);
1287  Put_Label_Cell(""); // wmc1 should be identical to nof
1288  fstr << "</TR>" << endl;
1289 
1290  fstr << "<TR>" << endl;
1291  Put_Label_Cell("Weighted Methods per Class (weighting = visible)");
1292  Put_Label_Cell("WMCv");
1293  Put_Metric_Cell(wmcv);
1294  Put_Label_Cell("");
1295  fstr << "</TR>" << endl;
1296 
1297  fstr << "<TR>" << endl;
1298  Put_Label_Cell("Depth of Inheritance Tree");
1299  Put_Label_Cell("DIT");
1300  Put_Metric_Cell(dit);
1301  Put_Label_Cell("");
1302  fstr << "</TR>" << endl;
1303 
1304  fstr << "<TR>" << endl;
1305  Put_Label_Cell("Number of Children");
1306  Put_Label_Cell("NOC");
1307  Put_Metric_Cell(noc);
1308  Put_Label_Cell("");
1309  fstr << "</TR>" << endl;
1310 
1311  fstr << "<TR>" << endl;
1312  Put_Label_Cell("Coupling between objects");
1313  Put_Label_Cell("CBO");
1314  Put_Metric_Cell(cbo);
1315  Put_Label_Cell("");
1316  fstr << "</TR>" << endl;
1317 
1318  fstr << "<TR>" << endl;
1319  Put_Label_Cell("Information Flow measure (inclusive)");
1320  Put_Label_Cell("IF4");
1321  Put_Metric_Cell(if4,1,"IF4");
1322  Put_Metric_Cell(if4,nof,"8.3");
1323  fstr << "</TR>" << endl;
1324 
1325  fstr << "<TR>" << endl;
1326  Put_Label_Cell("Information Flow measure (visible)");
1327  Put_Label_Cell("IF4v");
1328  Put_Metric_Cell(if4v,1,"IF4v");
1329  Put_Metric_Cell(if4v,nof,"8.3");
1330  fstr << "</TR>" << endl;
1331 
1332  fstr << "<TR>" << endl;
1333  Put_Label_Cell("Information Flow measure (concrete)");
1334  Put_Label_Cell("IF4c");
1335  Put_Metric_Cell(if4c,1,"IF4c");
1336  Put_Metric_Cell(if4c,nof,"8.3");
1337  fstr << "</TR>" << endl;
1338 
1339  fstr << "</TABLE>" << endl;
1340 }
void Put_Label_Cell(string label, int width=0, string ref_name="", string ref_href="", CCCC_Record *rec_ptr=0)
Definition: cccc_htm.cc:851
virtual int get_count(const char *count_tag)
Definition: cccc_mod.cc:64
void Put_Metric_Cell(const CCCC_Metric &metric, int width=0)
Definition: cccc_htm.cc:919
void Put_Header_Cell(string label, int width=0)
Definition: cccc_htm.cc:829
ofstream fstr
Definition: cccc_htm.h:50

Here is the call graph for this function:

void CCCC_Html_Stream::OO_Design ( )
private

Definition at line 426 of file cccc_htm.cc.

426  {
427  Put_Section_Heading("Object Oriented Design","oodesign",1);
428 
429  fstr << "<UL>" << endl;
430  Metric_Description("WMC","Weighted methods per class",
431  "The sum of a weighting function over the functions of "
432  "the module. Two different weighting functions are "
433  "applied: WMC1 uses the nominal weight of 1 for each "
434  "function, and hence measures the number of functions, "
435  "WMCv uses a weighting function which is 1 for functions "
436  "accessible to other modules, 0 for private functions.");
437  Metric_Description("DIT","Depth of inheritance tree",
438  "The length of the longest path of inheritance ending at "
439  "the current module. The deeper the inheritance tree "
440  "for a module, the harder it may be to predict its "
441  "behaviour. On the other hand, increasing depth gives "
442  "the potential of greater reuse by the current module "
443  "of behaviour defined for ancestor classes.");
444  Metric_Description("NOC","Number of children",
445  "The number of modules which inherit directly from the "
446  "current module. Moderate values of this measure "
447  "indicate scope for reuse, however high values may "
448  "indicate an inappropriate abstraction in the design.");
449  Metric_Description("CBO","Coupling between objects",
450  "The number of other modules which are coupled to the "
451  "current module either as a client or a supplier. "
452  "Excessive coupling indicates weakness of module "
453  "encapsulation and may inhibit reuse.");
454  fstr << "</UL>" << endl << endl;
455 
456  fstr << "The label cell for each row in this table provides a link to "
457  << "the module summary table in the detailed report for the "
458  << "module in question" << endl;
459 
460 
461  fstr << "<TABLE BORDER WIDTH=100%>" << endl
462  << "<TR>" << endl;
463  Put_Header_Cell("Module Name",50);
464  Put_Header_Cell("WMC1",10);
465  Put_Header_Cell("WMCv",10);
466  Put_Header_Cell("DIT",10);
467  Put_Header_Cell("NOC",10);
468  Put_Header_Cell("CBO",10);
469 
470  fstr << "</TR>" << endl;
471 
473  int i=0;
474  while(mod_ptr!=NULL)
475  {
476  i++;
477  if( mod_ptr->is_trivial() == FALSE)
478  {
479  const char *metric_tags[5]={"WMC1","WMCv","DIT","NOC","CBO"};
480  fstr << "<TR>" << endl;
481 
482  string href=mod_ptr->key()+".html#summary";
483 
484  Put_Label_Cell(mod_ptr->name(nlSIMPLE).c_str(),0,"",href.c_str());
485 
486  int j;
487  for(j=0; j<5; j++)
488  {
489  CCCC_Metric metric_value(
490  mod_ptr->get_count(metric_tags[j]),
491  metric_tags[j]
492  );
493  Put_Metric_Cell(metric_value);
494  }
495  fstr << "</TR>" << endl;
496 
497  }
498  mod_ptr=prjptr->module_table.next_item();
499  }
500 
501  fstr << "</TABLE>" << endl;
502 
503 }
CCCC_Table< CCCC_Module > module_table
Definition: cccc_prj.h:54
void Put_Section_Heading(string section_name, string section_tag, int section_level)
Definition: cccc_htm.cc:276
virtual string key() const
Definition: cccc_rec.cc:76
void Put_Label_Cell(string label, int width=0, string ref_name="", string ref_href="", CCCC_Record *rec_ptr=0)
Definition: cccc_htm.cc:851
static CCCC_Project * prjptr
Definition: cccc_htm.h:53
int is_trivial()
Definition: cccc_mod.cc:181
virtual int get_count(const char *count_tag)
Definition: cccc_mod.cc:64
T * first_item()
Definition: cccc_tbl.cc:118
void Put_Metric_Cell(const CCCC_Metric &metric, int width=0)
Definition: cccc_htm.cc:919
T * next_item()
Definition: cccc_tbl.cc:124
void Metric_Description(string abbreviation, string name, string description)
Definition: cccc_htm.cc:1204
string name(int name_level) const
Definition: cccc_mod.cc:35
void Put_Header_Cell(string label, int width=0)
Definition: cccc_htm.cc:829
ofstream fstr
Definition: cccc_htm.h:50

Here is the call graph for this function:

void CCCC_Html_Stream::Other_Extents ( )
private

Definition at line 780 of file cccc_htm.cc.

781 {
782  Put_Section_Heading("Other Extents","other",1);
783  fstr << "<TABLE BORDER WIDTH=100%>" << endl;
784  fstr << "<TR>" << endl;
785  Put_Header_Cell("Location",25);
786  Put_Header_Cell("Text",45);
787  Put_Header_Cell("LOC",10);
788  Put_Header_Cell("COM",10);
789  Put_Header_Cell("MVG",10);
790  fstr << "</TR>" << endl;
791 
793  {
794  fstr << "<TR><TD COLSPAN=5>"
795  << "&nbsp;"
796  << "</TD></TR>" << endl;
797  }
798  else
799  {
801  while(extent_ptr!=NULL)
802  {
803  fstr << "<TR>";
804  Put_Extent_Cell(*extent_ptr,0);
805  Put_Label_Cell(extent_ptr->name(nlDESCRIPTION).c_str());
806  Put_Metric_Cell(extent_ptr->get_count("LOC"),"");
807  Put_Metric_Cell(extent_ptr->get_count("COM"),"");
808  Put_Metric_Cell(extent_ptr->get_count("MVG"),"");
809  fstr << "</TR>" << endl;
810  extent_ptr=prjptr->rejected_extent_table.next_item();
811  }
812  }
813  fstr << "</TABLE>" << endl;
814 
815 }
void Put_Section_Heading(string section_name, string section_tag, int section_level)
Definition: cccc_htm.cc:276
void Put_Label_Cell(string label, int width=0, string ref_name="", string ref_href="", CCCC_Record *rec_ptr=0)
Definition: cccc_htm.cc:851
static CCCC_Project * prjptr
Definition: cccc_htm.h:53
CCCC_Table< CCCC_Extent > rejected_extent_table
Definition: cccc_prj.h:57
int get_count(const char *count_tag)
Definition: cccc_ext.cc:147
T * first_item()
Definition: cccc_tbl.cc:118
void Put_Metric_Cell(const CCCC_Metric &metric, int width=0)
Definition: cccc_htm.cc:919
T * next_item()
Definition: cccc_tbl.cc:124
void Put_Header_Cell(string label, int width=0)
Definition: cccc_htm.cc:829
int records()
Definition: cccc_tbl.cc:135
ofstream fstr
Definition: cccc_htm.h:50
string name(int index) const
Definition: cccc_ext.cc:107
void Put_Extent_Cell(const CCCC_Extent &extent, int width=0, bool withDescription=false)
Definition: cccc_htm.cc:962

Here is the call graph for this function:

void CCCC_Html_Stream::Procedural_Detail ( )
private

Definition at line 749 of file cccc_htm.cc.

749  {
750  Put_Section_Heading("Procedural Metrics Detail","procdet",1);
751 
752  fstr << "<TABLE BORDER WIDTH=100%>" << endl;
753 
755  while(mod_ptr!=NULL)
756  {
757  if(
758  (mod_ptr->name(nlMODULE_TYPE)!="builtin") &&
759  (mod_ptr->name(nlMODULE_TYPE)!="enum") &&
760  (mod_ptr->name(nlMODULE_TYPE)!="union")
761  )
762  {
763  fstr << "<TR>" << endl;
764  Put_Label_Cell(mod_ptr->name(nlSIMPLE).c_str(),50,
765  "procdet","procsum",mod_ptr);
766  Put_Header_Cell("LOC",10);
767  Put_Header_Cell("MVG",10);
768  Put_Header_Cell("COM",10);
769  Put_Header_Cell("L_C",10);
770  Put_Header_Cell("M_C",10);
771 
772  fstr << "</TR>" << endl;
773  Procedural_Detail(mod_ptr);
774  }
775  mod_ptr=prjptr->module_table.next_item();
776  }
777  fstr << "</TABLE>" << endl;
778 }
CCCC_Table< CCCC_Module > module_table
Definition: cccc_prj.h:54
void Put_Section_Heading(string section_name, string section_tag, int section_level)
Definition: cccc_htm.cc:276
void Put_Label_Cell(string label, int width=0, string ref_name="", string ref_href="", CCCC_Record *rec_ptr=0)
Definition: cccc_htm.cc:851
static CCCC_Project * prjptr
Definition: cccc_htm.h:53
void Procedural_Detail()
Definition: cccc_htm.cc:749
T * first_item()
Definition: cccc_tbl.cc:118
T * next_item()
Definition: cccc_tbl.cc:124
string name(int name_level) const
Definition: cccc_mod.cc:35
void Put_Header_Cell(string label, int width=0)
Definition: cccc_htm.cc:829
ofstream fstr
Definition: cccc_htm.h:50

Here is the call graph for this function:

void CCCC_Html_Stream::Procedural_Detail ( CCCC_Module module_ptr)
private

Definition at line 1154 of file cccc_htm.cc.

1155 {
1156  // this function generates the contents of the procedural detail table
1157  // relating to a single module
1158 
1159  // the output needs to be enveloped in a pair of <TABLE></TABLE> tags
1160  // these have not been put within the function because it is designed
1161  // to be used in two contexts:
1162  // 1. within the Separate_Modules function, wrapped directly in the table
1163  // tags
1164  // 2. within the Procedural_Detail function, where the table tags are
1165  // around the output of many calls to this function
1166 
1167  CCCC_Module::member_map_t::iterator iter = module_ptr->member_map.begin();
1168 
1169  if(iter==module_ptr->member_map.end())
1170  {
1171  fstr << "<TR><TD COLSPAN=6>"
1172  << "No member functions have been identified for this module"
1173  << "</TD></TR>" << endl;
1174  }
1175  else
1176  {
1177  while(iter!=module_ptr->member_map.end())
1178  {
1179  CCCC_Member *mem_ptr=(*iter).second;
1180  fstr << "<TR>" << endl;
1181  Put_Label_Cell(mem_ptr->name(nlLOCAL).c_str(),0,"","",mem_ptr);
1182  int loc=mem_ptr->get_count("LOC");
1183  int mvg=mem_ptr->get_count("MVG");
1184  int com=mem_ptr->get_count("COM");
1185  CCCC_Metric mloc(loc,"LOCf");
1186  CCCC_Metric mmvg(mvg,"MVGf");
1187  CCCC_Metric ml_c(loc,com,"L_C");
1188  CCCC_Metric mm_c(mvg,com,"M_C");
1189 
1190 
1191  Put_Metric_Cell(mloc);
1192  Put_Metric_Cell(mmvg);
1193  Put_Metric_Cell(com);
1194  Put_Metric_Cell(ml_c);
1195  Put_Metric_Cell(mm_c);
1196  fstr << "</TR>" << endl;
1197 
1198  iter++;
1199  }
1200  }
1201  fstr << "<TR><TD HEIGHT=12 COLSPAN=6></TD></TR>" << endl;
1202 }
int get_count(const char *count_tag)
Definition: cccc_mem.cc:35
void Put_Label_Cell(string label, int width=0, string ref_name="", string ref_href="", CCCC_Record *rec_ptr=0)
Definition: cccc_htm.cc:851
void Put_Metric_Cell(const CCCC_Metric &metric, int width=0)
Definition: cccc_htm.cc:919
string name(int index) const
Definition: cccc_mem.cc:99
member_map_t member_map
Definition: cccc_mod.h:51
ofstream fstr
Definition: cccc_htm.h:50

Here is the call graph for this function:

void CCCC_Html_Stream::Procedural_Summary ( )
private

Definition at line 505 of file cccc_htm.cc.

505  {
506  Put_Section_Heading("Procedural Metrics Summary","procsum",1);
507 
508  fstr << "For descriptions of each of these metrics see the information "
509  << "preceding the project summary table."
510  << endl << endl;
511 
512  fstr << "The label cell for each row in this table provides a link to "
513  << "the functions table in the detailed report for the "
514  << "module in question" << endl;
515 
516  fstr << "<TABLE BORDER WIDTH=100%>" << endl
517  << "<TR>" << endl;
518  Put_Header_Cell("Module Name");
519  Put_Header_Cell("LOC",8);
520  Put_Header_Cell("MVG",8);
521  Put_Header_Cell("COM",8);
522  Put_Header_Cell("L_C",8);
523  Put_Header_Cell("M_C",8);
524 
525  fstr << "</TR>" << endl;
526 
528  int i=0;
529  while(mod_ptr!=NULL)
530  {
531  i++;
532  if( mod_ptr->is_trivial() == FALSE)
533  {
534  fstr << "<TR>" << endl;
535  string href=mod_ptr->key()+".html#procdet";
536 
537  Put_Label_Cell(mod_ptr->name(nlSIMPLE).c_str(),0,"",href.c_str());
538  int loc=mod_ptr->get_count("LOC");
539  int mvg=mod_ptr->get_count("MVG");
540  int com=mod_ptr->get_count("COM");
541  CCCC_Metric mloc(loc,"LOCm");
542  CCCC_Metric mmvg(mvg,"MVGm");
543  CCCC_Metric ml_c(loc,com,"L_C");
544  CCCC_Metric mm_c(mvg,com,"M_C");
545 
546  Put_Metric_Cell(mloc);
547  Put_Metric_Cell(mmvg);
548  Put_Metric_Cell(com);
549  Put_Metric_Cell(ml_c);
550  Put_Metric_Cell(mm_c);
551 
552  fstr << "</TR>" << endl;
553 
554  }
555  mod_ptr=prjptr->module_table.next_item();
556  }
557 
558  fstr << "</TABLE>" << endl;
559 
560 }
CCCC_Table< CCCC_Module > module_table
Definition: cccc_prj.h:54
void Put_Section_Heading(string section_name, string section_tag, int section_level)
Definition: cccc_htm.cc:276
virtual string key() const
Definition: cccc_rec.cc:76
void Put_Label_Cell(string label, int width=0, string ref_name="", string ref_href="", CCCC_Record *rec_ptr=0)
Definition: cccc_htm.cc:851
static CCCC_Project * prjptr
Definition: cccc_htm.h:53
int is_trivial()
Definition: cccc_mod.cc:181
virtual int get_count(const char *count_tag)
Definition: cccc_mod.cc:64
T * first_item()
Definition: cccc_tbl.cc:118
void Put_Metric_Cell(const CCCC_Metric &metric, int width=0)
Definition: cccc_htm.cc:919
T * next_item()
Definition: cccc_tbl.cc:124
string name(int name_level) const
Definition: cccc_mod.cc:35
void Put_Header_Cell(string label, int width=0)
Definition: cccc_htm.cc:829
ofstream fstr
Definition: cccc_htm.h:50

Here is the call graph for this function:

void CCCC_Html_Stream::Project_Summary ( )
private

Definition at line 288 of file cccc_htm.cc.

288  {
289  Put_Section_Heading("Project Summary","projsum",1);
290 
291  fstr << "This table shows measures over the project as a whole." << endl;
292 
293  fstr << "<UL>" << endl;
294  Metric_Description("NOM","Number of modules",
295  "Number of non-trivial modules identified by the "
296  "analyser. Non-trivial modules include all classes, "
297  "and any other module for which member functions are "
298  "identified.");
299  Metric_Description("LOC","Lines of Code",
300  "Number of non-blank, non-comment lines of source code "
301  "counted by the analyser.");
302  Metric_Description("COM","Lines of Comments",
303  "Number of lines of comment identified by the analyser");
304  Metric_Description("MVG","McCabe's Cyclomatic Complexity",
305  "A measure of the decision complexity of the functions "
306  "which make up the program."
307  "The strict definition of this measure is that it is "
308  "the number of linearly independent routes through "
309  "a directed acyclic graph which maps the flow of control "
310  "of a subprogram. The analyser counts this by recording "
311  "the number of distinct decision outcomes contained "
312  "within each function, which yields a good approximation "
313  "to the formally defined version of the measure.");
314  Metric_Description("L_C","Lines of code per line of comment",
315  "Indicates density of comments with respect to textual "
316  "size of program");
317  Metric_Description("M_C","Cyclomatic Complexity per line of comment",
318  "Indicates density of comments with respect to logical "
319  "complexity of program");
320  Metric_Description("IF4","Information Flow measure",
321  "Measure of information flow between modules suggested "
322  "by Henry and Kafura. The analyser makes an approximate "
323  "count of this by counting inter-module couplings "
324  "identified in the module interfaces.");
325 
326  fstr << "</UL>" << endl
327  << "Two variants on the information flow measure IF4 are also "
328  << "presented, one (IF4v) calculated using only relationships in the "
329  << "visible part of the module interface, and the other (IF4c) "
330  << "calculated using only those relationships which imply that changes "
331  << "to the client must be recompiled of the supplier's definition "
332  << "changes."
333  << endl << endl;
334 
335  // calculate the counts on which all displayed data will be based
336  int nom=prjptr->get_count("NOM"); // number of modules
337  int loc=prjptr->get_count("LOC"); // lines of code
338  int mvg=prjptr->get_count("MVG"); // McCabes cyclomatic complexity
339  int com=prjptr->get_count("COM"); // lines of comment
340  int if4=prjptr->get_count("IF4"); // intermodule complexity (all couplings)
341  int if4v=prjptr->get_count("IF4v"); // intermodule complexity (visible only)
342  int if4c=prjptr->get_count("IF4c"); // intermodule complexity (concrete only)
343  int rej=prjptr->rejected_extent_table.get_count("LOC");
344 
345  fstr << "<TABLE BORDER WIDTH=100%>" << endl
346  << "<TR>" << endl;
347  Put_Header_Cell("Metric",70);
348  Put_Header_Cell("Tag",10);
349  Put_Header_Cell("Overall",10);
350  Put_Header_Cell("Per Module",10);
351  fstr << "</TR>" << endl;
352 
353  fstr << "<TR>" << endl;
354  Put_Label_Cell("Number of modules");
355  Put_Label_Cell("NOM");
356  Put_Metric_Cell(nom);
357  Put_Label_Cell("");
358  fstr << "</TR>" << endl;
359 
360  fstr << "<TR>" << endl;
361  Put_Label_Cell("Lines of Code",700);
362  Put_Label_Cell("LOC",120);
363  Put_Metric_Cell(loc,"LOCp");
364  Put_Metric_Cell(loc,nom,"LOCper");
365  fstr << "</TR>" << endl;
366 
367  fstr << "<TR>" << endl;
368  Put_Label_Cell("McCabe's Cyclomatic Number");
369  Put_Label_Cell("MVG");
370  Put_Metric_Cell(mvg,"MVGp");
371  Put_Metric_Cell(mvg,nom,"MVGper");
372  fstr << "</TR>" << endl;
373 
374  fstr << "<TR>" << endl;
375  Put_Label_Cell("Lines of Comment");
376  Put_Label_Cell("COM");
377  Put_Metric_Cell(com,"COM");
378  Put_Metric_Cell(com,nom,"COMper");
379  fstr << "</TR>" << endl;
380 
381  fstr << "<TR>" << endl;
382  Put_Label_Cell("LOC/COM");
383  Put_Label_Cell("L_C");
384  Put_Metric_Cell(loc,com,"L_C");
385  Put_Label_Cell("");
386  fstr << "</TR>" << endl;
387 
388  fstr << "<TR>" << endl;
389  Put_Label_Cell("MVG/COM");
390  Put_Label_Cell("M_C");
391  Put_Metric_Cell(mvg,com,"M_C");
392  Put_Label_Cell("");
393  fstr << "</TR>" << endl;
394 
395  fstr << "<TR>" << endl;
396  Put_Label_Cell("Information Flow measure (inclusive)");
397  Put_Label_Cell("IF4");
398  Put_Metric_Cell(if4);
399  Put_Metric_Cell(if4,nom,"8.3");
400  fstr << "</TR>" << endl;
401 
402  fstr << "<TR>" << endl;
403  Put_Label_Cell("Information Flow measure (visible)");
404  Put_Label_Cell("IF4v");
405  Put_Metric_Cell(if4v);
406  Put_Metric_Cell(if4v,nom,"8.3");
407  fstr << "</TR>" << endl;
408 
409  fstr << "<TR>" << endl;
410  Put_Label_Cell("Information Flow measure (concrete)");
411  Put_Label_Cell("IF4c");
412  Put_Metric_Cell(if4c);
413  Put_Metric_Cell(if4c,nom,"8.3");
414  fstr << "</TR>" << endl;
415 
416  fstr << "<TR>" << endl;
417  Put_Label_Cell("Lines of Code rejected by parser");
418  Put_Label_Cell("REJ");
419  Put_Metric_Cell(rej,"REJ");
420  Put_Label_Cell("");
421  fstr << "</TR>" << endl;
422 
423  fstr << "</TABLE>" << endl;
424 }
void Put_Section_Heading(string section_name, string section_tag, int section_level)
Definition: cccc_htm.cc:276
void Put_Label_Cell(string label, int width=0, string ref_name="", string ref_href="", CCCC_Record *rec_ptr=0)
Definition: cccc_htm.cc:851
static CCCC_Project * prjptr
Definition: cccc_htm.h:53
CCCC_Table< CCCC_Extent > rejected_extent_table
Definition: cccc_prj.h:57
virtual int get_count(const char *count_tag)
Definition: cccc_tbl.cc:52
void Put_Metric_Cell(const CCCC_Metric &metric, int width=0)
Definition: cccc_htm.cc:919
void Metric_Description(string abbreviation, string name, string description)
Definition: cccc_htm.cc:1204
void Put_Header_Cell(string label, int width=0)
Definition: cccc_htm.cc:829
int get_count(const char *count_tag)
Definition: cccc_prj.cc:308
ofstream fstr
Definition: cccc_htm.h:50

Here is the call graph for this function:

void CCCC_Html_Stream::Put_Extent_Cell ( const CCCC_Extent extent,
int  width = 0,
bool  withDescription = false 
)
private

Definition at line 962 of file cccc_htm.cc.

962  {
963  fstr << "<TD";
964  if(width>0)
965  {
966  fstr << " WIDTH=" << width << "%>";
967  }
968  else
969  {
970  fstr << ">";
971  }
972  if(withDescription)
973  {
974  fstr << extent.name(nlDESCRIPTION) << " &nbsp;" << endl;
975  }
976  Put_Extent_URL(extent);
977  fstr << "</TD>" << endl;
978 }
void Put_Extent_URL(const CCCC_Extent &extent)
Definition: cccc_htm.cc:946
ofstream fstr
Definition: cccc_htm.h:50
string name(int index) const
Definition: cccc_ext.cc:107

Here is the call graph for this function:

Here is the caller graph for this function:

void CCCC_Html_Stream::Put_Extent_List ( CCCC_Record record,
bool  withDescription = false 
)
private

Definition at line 980 of file cccc_htm.cc.

981 {
982  CCCC_Extent *ext_ptr=record.extent_table.first_item();
983  while(ext_ptr!=NULL)
984  {
985  if(withDescription)
986  {
987  fstr << ext_ptr->name(nlDESCRIPTION) << " &nbsp;" << endl;
988  }
989  Put_Extent_URL(*ext_ptr);
990  ext_ptr=record.extent_table.next_item();
991  }
992  fstr << "<BR>" << endl;
993 }
void Put_Extent_URL(const CCCC_Extent &extent)
Definition: cccc_htm.cc:946
T * first_item()
Definition: cccc_tbl.cc:118
T * next_item()
Definition: cccc_tbl.cc:124
Extent_Table extent_table
Definition: cccc_rec.h:45
ofstream fstr
Definition: cccc_htm.h:50
string name(int index) const
Definition: cccc_ext.cc:107

Here is the call graph for this function:

Here is the caller graph for this function:

void CCCC_Html_Stream::Put_Extent_URL ( const CCCC_Extent extent)
private

Definition at line 946 of file cccc_htm.cc.

947 {
948  string filename=extent.name(nlFILENAME);
949  int linenumber=atoi(extent.name(nlLINENUMBER).c_str());
950 
951  Source_Anchor anchor(filename, linenumber);
952  string key=anchor.key();
953  source_anchor_map_t::value_type anchor_value(key, anchor);
954  source_anchor_map.insert(anchor_value);
955 
956  anchor.Emit_HREF(fstr);
957  fstr
958  // << extent.name(nlDESCRIPTION)
959  << "<BR>" << endl;
960 }
ofstream fstr
Definition: cccc_htm.h:50
string name(int index) const
Definition: cccc_ext.cc:107
source_anchor_map_t source_anchor_map
Definition: cccc_htm.cc:47

Here is the call graph for this function:

Here is the caller graph for this function:

void CCCC_Html_Stream::Put_Header_Cell ( string  label,
int  width = 0 
)
private

Definition at line 829 of file cccc_htm.cc.

830 {
831  fstr << "<TH BGCOLOR=\"AQUA\"";
832  if(width>0)
833  {
834  fstr << " WIDTH=" << width << "%" ;
835  }
836  fstr << ">" ;
837  if(label.size()>0)
838  {
839  *this << label.c_str();
840  }
841  else
842  {
843  // put a non-breaking space in to avoid the strange
844  // bevelling associated with empty cells
845  fstr << "&nbsp;";
846 
847  }
848  fstr << "</TH>";
849 }
ofstream fstr
Definition: cccc_htm.h:50

Here is the caller graph for this function:

void CCCC_Html_Stream::Put_Label_Cell ( string  label,
int  width = 0,
string  ref_name = "",
string  ref_href = "",
CCCC_Record rec_ptr = 0 
)
private

Definition at line 851 of file cccc_htm.cc.

855 {
856  fstr << "<TD";
857  if(width>0)
858  {
859  fstr << " WIDTH=" << width <<"%";
860  }
861  fstr << ">" ;
862 
863  if(ref_name.size() > 0)
864  {
865  // we need to insert an HTML "<A NAME=...> tag for the current cell
866  // this enables other locations to jump in
867  fstr << "<A NAME=\"" << ref_name << "\"></A>" << endl;
868  }
869 
870  if(ref_href.size() > 0)
871  {
872  // we need to insert an HTML <A HREF=...> tag for the current cell
873  // this enables this cell to be a link to jump out
874  fstr << "<A HREF=\"" << ref_href << "\">" << endl;
875  // this anchor will need to be closed after the label has been displayed
876  }
877 
878  if(label.size()>0)
879  {
880  *this << label.c_str() ;
881  }
882  else
883  {
884  // put a non-breaking space in to avoid the strange
885  // bevelling associated with empty cells
886  fstr << "&nbsp;";
887  }
888 
889  if(ref_href.size() > 0)
890  {
891  // closing the anchor we opened above
892  fstr << "</A>" << endl;
893  }
894 
895  if(rec_ptr != 0)
896  {
897  fstr << "<BR>" << endl;
898  Put_Extent_List(*rec_ptr,true);
899  }
900 
901  fstr << "</TD>";
902 }
void Put_Extent_List(CCCC_Record &record, bool withDescription=false)
Definition: cccc_htm.cc:980
ofstream fstr
Definition: cccc_htm.h:50

Here is the call graph for this function:

Here is the caller graph for this function:

void CCCC_Html_Stream::Put_Metric_Cell ( const CCCC_Metric metric,
int  width = 0 
)
private

Definition at line 919 of file cccc_htm.cc.

920 {
921  fstr << "<TD ALIGN=RIGHT";
922 
923  if(width>0)
924  {
925  fstr << " WIDTH=" << width << "%" ;
926  }
927 
928  switch(metric.emphasis_level())
929  {
930  case elMEDIUM:
931  fstr << " BGCOLOR=\"YELLOW\"";
932  break;
933  case elHIGH:
934  fstr << " BGCOLOR=\"RED\"";
935  break;
936  default:
937  // no background colour
938  break;
939  }
940  fstr << ">";
941 
942  *this << metric;
943  fstr << "</TD>";
944 }
EmphasisLevel emphasis_level() const
Definition: cccc_met.cc:85
ofstream fstr
Definition: cccc_htm.h:50

Here is the call graph for this function:

Here is the caller graph for this function:

void CCCC_Html_Stream::Put_Metric_Cell ( int  count,
string  tag,
int  width = 0 
)
private

Definition at line 905 of file cccc_htm.cc.

907 {
908  CCCC_Metric m(count, tag.c_str());
909  Put_Metric_Cell(m, width);
910 }
void Put_Metric_Cell(const CCCC_Metric &metric, int width=0)
Definition: cccc_htm.cc:919

Here is the call graph for this function:

void CCCC_Html_Stream::Put_Metric_Cell ( int  num,
int  denom,
string  tag,
int  width = 0 
)
private

Definition at line 912 of file cccc_htm.cc.

914 {
915  CCCC_Metric m(num,denom, tag.c_str());
916  Put_Metric_Cell(m, width);
917 }
void Put_Metric_Cell(const CCCC_Metric &metric, int width=0)
Definition: cccc_htm.cc:919

Here is the call graph for this function:

void CCCC_Html_Stream::Put_Section_Heading ( string  section_name,
string  section_tag,
int  section_level 
)
private

Definition at line 276 of file cccc_htm.cc.

280 {
281  fstr << "<H" << heading_level << ">"
282  << "<A NAME=\"" << heading_tag << "\">"
283  << heading_title
284  << "</A></H" << heading_level
285  << ">" << endl;
286 }
ofstream fstr
Definition: cccc_htm.h:50

Here is the caller graph for this function:

void CCCC_Html_Stream::Put_Section_TOC_Entry ( string  section_name,
string  section_href,
string  section_description 
)
private

Definition at line 817 of file cccc_htm.cc.

820 {
821  fstr << "<TR>" << endl
822  << "<TH><H4><A HREF=\"#" << section_href << "\">"
823  << section_name << "</A></H4></TH>" << endl
824  << "<TD>" << endl
825  << section_description << endl
826  << "</TR>" << endl;
827 }
ofstream fstr
Definition: cccc_htm.h:50

Here is the caller graph for this function:

void CCCC_Html_Stream::Put_Structural_Details_Cell ( CCCC_Module mod,
CCCC_Project prj,
int  mask,
UserelNameLevel  nl 
)
private

Definition at line 653 of file cccc_htm.cc.

655 {
656  fstr << "<TD WIDTH=50%>" << endl;
657 
658 #if 0
659  std::cerr << "Relationships for " << mod->name(nlMODULE_NAME)
660  << " (" << mod << ")" << std::endl;
661 #endif
662 
663  CCCC_Module::relationship_map_t::iterator iter;
664  CCCC_Module::relationship_map_t *relationship_map=NULL;
665  if(mask==rmeCLIENT)
666  {
667  relationship_map=&(mod->client_map);
668  }
669  else if(mask==rmeSUPPLIER)
670  {
671  relationship_map=&(mod->supplier_map);
672  }
673 
674  if(relationship_map==NULL)
675  {
676  cerr << "unexpected relationship mask " << mask << endl;
677  }
678  else
679  {
680  for(
681  iter=relationship_map->begin();
682  iter!=relationship_map->end();
683  iter++
684  )
685  {
686  CCCC_UseRelationship *ur_ptr=(*iter).second;
687  fstr << ur_ptr->name(nl) << " ";
688  AugmentedBool vis=ur_ptr->is_visible();
689  AugmentedBool con=ur_ptr->is_concrete();
690 
691 #if 0
692  std::cerr << ur_ptr->name(nlCLIENT)
693  << " uses "
694  << ur_ptr->name(nlSUPPLIER)
695  << std::endl;
696 #endif
697 
698  if( (vis != abFALSE) && (con != abFALSE) )
699  {
700  fstr << "[CV] ";
701  }
702  else if(vis != abFALSE)
703  {
704  fstr << "[V] ";
705  }
706  else if(con != abFALSE)
707  {
708  fstr << "[C] ";
709  }
710  fstr << "<BR>" << endl;
711  Put_Extent_List(*ur_ptr,true);
712  fstr << "<BR>" << endl;
713  }
714  }
715  // put a non-breaking space in to avoid the unpleasantness which
716  // goes with completely empty cells
717  fstr << "&nbsp;" << endl;
718 
719  fstr << "</TD>" << endl;
720 
721 }
relationship_map_t client_map
Definition: cccc_mod.h:54
string name(int index) const
Definition: cccc_use.cc:40
void Put_Extent_List(CCCC_Record &record, bool withDescription=false)
Definition: cccc_htm.cc:980
AugmentedBool is_concrete() const
Definition: cccc_use.h:51
string name(int name_level) const
Definition: cccc_mod.cc:35
relationship_map_t supplier_map
Definition: cccc_mod.h:55
AugmentedBool is_visible() const
Definition: cccc_use.h:50
std::map< string, CCCC_UseRelationship * > relationship_map_t
Definition: cccc_mod.h:53
AugmentedBool
Definition: cccc_utl.h:59
ofstream fstr
Definition: cccc_htm.h:50

Here is the call graph for this function:

Here is the caller graph for this function:

void CCCC_Html_Stream::Separate_Module_Link ( CCCC_Module module_ptr)
private
void CCCC_Html_Stream::Separate_Modules ( )
private

Definition at line 1039 of file cccc_htm.cc.

1040 {
1041  // this function generates a separate HTML report for each non-trivial
1042  // module in the database
1043 
1045  while(mod_ptr!=NULL)
1046  {
1047  int trivial_module=mod_ptr->is_trivial();
1048  if(trivial_module==FALSE)
1049  {
1050  string info="Detailed report on module " + mod_ptr->key();
1051  string filename=outdir;
1052  filename+="/";
1053  filename+=mod_ptr->key()+".html";
1054  CCCC_Html_Stream module_html_str(filename,info.c_str());
1055 
1056  module_html_str.Put_Section_Heading(info.c_str(),"summary",1);
1057 
1058  module_html_str.Module_Summary(mod_ptr);
1059 
1060  module_html_str.Put_Section_Heading("Definitions and Declarations",
1061  "modext",2);
1062  module_html_str.fstr << "<TABLE BORDER WIDTH=100%><TR>" << endl;
1063  module_html_str.Put_Label_Cell("Description",50);
1064  module_html_str.Put_Header_Cell("LOC",10);
1065  module_html_str.Put_Header_Cell("MVG",10);
1066  module_html_str.Put_Header_Cell("COM",10);
1067  module_html_str.Put_Header_Cell("L_C",10);
1068  module_html_str.Put_Header_Cell("M_C",10);
1069  module_html_str.Module_Detail(mod_ptr);
1070  module_html_str.fstr << "</TR></TABLE>" << endl;
1071 
1072  module_html_str.Put_Section_Heading("Functions","proc",2);
1073  module_html_str.fstr << "<TABLE BORDER WIDTH=100%><TR>" << endl;
1074  module_html_str.Put_Label_Cell("Function prototype",50);
1075  module_html_str.Put_Header_Cell("LOC",10);
1076  module_html_str.Put_Header_Cell("MVG",10);
1077  module_html_str.Put_Header_Cell("COM",10);
1078  module_html_str.Put_Header_Cell("L_C",10);
1079  module_html_str.Put_Header_Cell("M_C",10);
1080  module_html_str.Procedural_Detail(mod_ptr);
1081  module_html_str.fstr << "</TR></TABLE>" << endl;
1082 
1083  module_html_str.Put_Section_Heading("Relationships","structdet",2);
1084  module_html_str.fstr
1085  << "<TABLE BORDER WIDTH=100%>" << endl
1086  << "<TR><TH WIDTH=50%>Clients</TH><TH WIDTH=50%>Suppliers</TH></TR>"
1087  << endl
1088  << "<TR>" << endl;
1089  module_html_str.Structural_Detail(mod_ptr);
1090  module_html_str.fstr << "</TR></TABLE>" << endl;
1091 
1092 
1093  }
1094  else
1095  {
1096 #if 0
1097  cerr << mod_ptr->module_type << " " << mod_ptr->key()
1098  << " is trivial" << endl;
1099 #endif
1100  }
1101  mod_ptr=prjptr->module_table.next_item();
1102  }
1103 }
CCCC_Table< CCCC_Module > module_table
Definition: cccc_prj.h:54
void Put_Section_Heading(string section_name, string section_tag, int section_level)
Definition: cccc_htm.cc:276
virtual string key() const
Definition: cccc_rec.cc:76
static CCCC_Project * prjptr
Definition: cccc_htm.h:53
int is_trivial()
Definition: cccc_mod.cc:181
string module_type
Definition: cccc_mod.h:48
T * first_item()
Definition: cccc_tbl.cc:118
static string outdir
Definition: cccc_htm.h:52
T * next_item()
Definition: cccc_tbl.cc:124

Here is the call graph for this function:

void CCCC_Html_Stream::Source_Listing ( )
private

Definition at line 1382 of file cccc_htm.cc.

1383 {
1384  // The variable stream src_str used to be an instance
1385  // of fstream which gets reopened many times.
1386  // this worked under Linux but broke under Win32, so
1387  // this variable is now a pointer which is repeatedly
1388  // deleted and new'ed
1389 
1390  string current_filename;
1391  int current_line=0;
1392  int next_anchor_required=0;
1393  ifstream *src_str=NULL;
1394  const char *style_open="<TT>", *style_close="</TT>";
1395 
1396  string filename=outdir;
1397  filename+="/cccc_src.html";
1398  CCCC_Html_Stream source_html_str(filename.c_str(),"source file");
1399 
1400  source_html_str.fstr << style_open << endl;
1401 
1402  source_anchor_map_t::iterator iter=source_anchor_map.begin();
1403  while(iter!=source_anchor_map.end())
1404  {
1405  char linebuf[1024];
1406  Source_Anchor& nextAnchor=(*iter).second;
1407  if(current_filename!=nextAnchor.get_file())
1408  {
1409  current_filename=nextAnchor.get_file();
1410  current_line=0;
1411  delete src_str;
1412  src_str=new ifstream(current_filename.c_str(),std::ios::in);
1413  src_str->getline(linebuf,1023);
1414  source_html_str.fstr << style_close << endl;
1415  source_html_str.Put_Section_Heading(current_filename.c_str(),"",1);
1416  source_html_str.fstr << style_open << endl;
1417  }
1418 
1419  while(src_str->good())
1420  {
1421  current_line++;
1422  if(
1423  (iter!=source_anchor_map.end()) &&
1424  (current_filename==(*iter).second.get_file()) &&
1425  (current_line==(*iter).second.get_line())
1426  )
1427  {
1428  (*iter).second.Emit_NAME(source_html_str.fstr);
1429  iter++;
1430  }
1431  else
1432  {
1433  (*iter).second.Emit_SPACE(source_html_str.fstr);
1434  }
1435  source_html_str << linebuf;
1436  source_html_str.fstr << "<BR>" << endl;
1437  src_str->getline(linebuf,1023);
1438  }
1439 
1440  // if there are any remaining anchors for this file the sorting
1441  // by line number must be wrong
1442  // complain and ignore
1443  while(
1444  (iter!=source_anchor_map.end()) &&
1445  (current_filename==(*iter).second.get_file())
1446  )
1447  {
1448  (*iter).second.Emit_NAME(source_html_str.fstr);
1449  iter++;
1450  source_html_str.fstr << "<BR>" << endl;
1451  }
1452 
1453 
1454  }
1455 
1456  // delete the last input stream created
1457  delete src_str;
1458 
1459  source_html_str.fstr << style_close << " </BODY></HTML>" << endl;
1460 
1461 }
static string outdir
Definition: cccc_htm.h:52
string get_file() const
Definition: cccc_htm.h:129
string current_filename
Definition: ccccmain.cc:67
ofstream fstr
Definition: cccc_htm.h:50
source_anchor_map_t source_anchor_map
Definition: cccc_htm.cc:47

Here is the call graph for this function:

void CCCC_Html_Stream::Structural_Detail ( )
private

Definition at line 723 of file cccc_htm.cc.

724 {
725  Put_Section_Heading("Structural Metrics Detail","structdet",1);
726  fstr << "<TABLE BORDER WIDTH=100%>" << endl;
727  fstr << "<TR>" << endl;
728  Put_Header_Cell("Module Name",20);
729  Put_Header_Cell("Clients",40);
730  Put_Header_Cell("Suppliers",40);
731  fstr << "</TR>" << endl;
732 
733  CCCC_Module* module_ptr=prjptr->module_table.first_item();
734  while(module_ptr!=NULL)
735  {
736  if(module_ptr->is_trivial()==FALSE)
737  {
738  fstr << "<TR>" << endl;
739  Put_Label_Cell(module_ptr->name(nlSIMPLE).c_str(), 0, "structdet","structsum");
740  Structural_Detail(module_ptr);
741  fstr << "</TR>" << endl;
742  }
743  module_ptr=prjptr->module_table.next_item();
744  }
745  fstr << "</TABLE>" << endl;
746 
747 }
CCCC_Table< CCCC_Module > module_table
Definition: cccc_prj.h:54
void Put_Section_Heading(string section_name, string section_tag, int section_level)
Definition: cccc_htm.cc:276
void Put_Label_Cell(string label, int width=0, string ref_name="", string ref_href="", CCCC_Record *rec_ptr=0)
Definition: cccc_htm.cc:851
static CCCC_Project * prjptr
Definition: cccc_htm.h:53
int is_trivial()
Definition: cccc_mod.cc:181
void Structural_Detail()
Definition: cccc_htm.cc:723
T * first_item()
Definition: cccc_tbl.cc:118
T * next_item()
Definition: cccc_tbl.cc:124
string name(int name_level) const
Definition: cccc_mod.cc:35
void Put_Header_Cell(string label, int width=0)
Definition: cccc_htm.cc:829
ofstream fstr
Definition: cccc_htm.h:50

Here is the call graph for this function:

void CCCC_Html_Stream::Structural_Detail ( CCCC_Module module_ptr)
private

Definition at line 1214 of file cccc_htm.cc.

1215 {
1218 }
static CCCC_Project * prjptr
Definition: cccc_htm.h:53
void Put_Structural_Details_Cell(CCCC_Module *mod, CCCC_Project *prj, int mask, UserelNameLevel nl)
Definition: cccc_htm.cc:653

Here is the call graph for this function:

void CCCC_Html_Stream::Structural_Summary ( )
private

Definition at line 562 of file cccc_htm.cc.

563 {
564  Put_Section_Heading("Structural Metrics Summary","structsum",1);
565 
566  fstr << "<UL>" << endl;
567  Metric_Description("FI","Fan-in",
568  "The number of other modules which pass information "
569  "into the current module.");
570  Metric_Description("FO","Fan-out",
571  "The number of other modules into which the current "
572  "module passes information");
573  Metric_Description("IF4","Information Flow measure",
574  "A composite measure of structural complexity, "
575  "calculated as the square of the product of the fan-in "
576  "and fan-out of a single module. Proposed by Henry and "
577  "Kafura.");
578  fstr << "</UL>" << endl;
579 
580  fstr << "Note that the fan-in and fan-out are calculated by examining the "
581  << "interface of each module. As noted above, three variants of each "
582  << "each of these measures are presented: a count restricted to the "
583  << "part of the interface which is externally visible, a count which "
584  << "only includes relationships which imply the client module needs "
585  << "to be recompiled if the supplier's implementation changes, and an "
586  << "inclusive count" << endl << endl;
587 
588 
589  fstr << "The label cell for each row in this table provides a link to "
590  << "the relationships table in the detailed report for the "
591  << "module in question" << endl << endl;
592 
593  fstr << "<TABLE BORDER WIDTH=100%>" << endl;
594  fstr << "<TR>" << endl
595  << "<TH BGCOLOR=AQUA ROWSPAN=2>Module Name</TH>" << endl
596  << "<TH BGCOLOR=AQUA COLSPAN=3>Fan-out</TH>" << endl
597  << "<TH BGCOLOR=AQUA COLSPAN=3>Fan-in</TH>" << endl
598  << "<TH BGCOLOR=AQUA COLSPAN=3>IF4</TH>" << endl
599  << "</TR>" << endl;
600  Put_Header_Cell("vis",7);
601  Put_Header_Cell("con",7);
602  Put_Header_Cell("inc",7);
603  Put_Header_Cell("vis",7);
604  Put_Header_Cell("con",7);
605  Put_Header_Cell("incl",7);
606  Put_Header_Cell("vis",7);
607  Put_Header_Cell("con",7);
608  Put_Header_Cell("inc",7);
609 
610  fstr << "</TR>" << endl;
611 
612  CCCC_Module* module_ptr=prjptr->module_table.first_item();
613  while(module_ptr!=NULL)
614  {
615  if(module_ptr->is_trivial()==FALSE)
616  {
617  fstr << "<TR>" << endl;
618 
619  int fov=module_ptr->get_count("FOv");
620  int foc=module_ptr->get_count("FOc");
621  int fo=module_ptr->get_count("FO");
622 
623  int fiv=module_ptr->get_count("FIv");
624  int fic=module_ptr->get_count("FIc");
625  int fi=module_ptr->get_count("FI");
626 
627  int if4v=module_ptr->get_count("IF4v");
628  int if4c=module_ptr->get_count("IF4c");
629  int if4=module_ptr->get_count("IF4");
630 
631  // the last two arguments here turn on links to enable jumping between
632  // the summary and detail cells for the same module
633  string href=module_ptr->key()+".html#structdet";
634  Put_Label_Cell(module_ptr->name(nlSIMPLE).c_str(), 0, "",href.c_str());
635  Put_Metric_Cell(CCCC_Metric(fov,"FOv"));
636  Put_Metric_Cell(CCCC_Metric(foc,"FOc"));
637  Put_Metric_Cell(CCCC_Metric(fo,"FO"));
638  Put_Metric_Cell(CCCC_Metric(fiv,"FIv"));
639  Put_Metric_Cell(CCCC_Metric(fic,"FIc"));
640  Put_Metric_Cell(CCCC_Metric(fi,"FI"));
641  Put_Metric_Cell(CCCC_Metric(if4v,"IF4v"));
642  Put_Metric_Cell(CCCC_Metric(if4c,"IF4c"));
643  Put_Metric_Cell(CCCC_Metric(if4,"IF4"));
644 
645  fstr << "</TR>" << endl;
646  }
647  module_ptr=prjptr->module_table.next_item();
648  }
649  fstr << "</TABLE>" << endl;
650 
651 }
CCCC_Table< CCCC_Module > module_table
Definition: cccc_prj.h:54
void Put_Section_Heading(string section_name, string section_tag, int section_level)
Definition: cccc_htm.cc:276
virtual string key() const
Definition: cccc_rec.cc:76
void Put_Label_Cell(string label, int width=0, string ref_name="", string ref_href="", CCCC_Record *rec_ptr=0)
Definition: cccc_htm.cc:851
static CCCC_Project * prjptr
Definition: cccc_htm.h:53
int is_trivial()
Definition: cccc_mod.cc:181
virtual int get_count(const char *count_tag)
Definition: cccc_mod.cc:64
T * first_item()
Definition: cccc_tbl.cc:118
void Put_Metric_Cell(const CCCC_Metric &metric, int width=0)
Definition: cccc_htm.cc:919
T * next_item()
Definition: cccc_tbl.cc:124
void Metric_Description(string abbreviation, string name, string description)
Definition: cccc_htm.cc:1204
string name(int name_level) const
Definition: cccc_mod.cc:35
void Put_Header_Cell(string label, int width=0)
Definition: cccc_htm.cc:829
ofstream fstr
Definition: cccc_htm.h:50

Here is the call graph for this function:

void CCCC_Html_Stream::Table_Of_Contents ( int  report_mask,
bool  showGenTime 
)
private

Definition at line 154 of file cccc_htm.cc.

155 {
156  // record the number of report parts in the table, and the
157  // stream put pointer
158  // if we find that we have only generated a single part, we supress
159  // the TOC by seeking to the saved stream offset
160  int number_of_report_parts=0;
161  int saved_stream_offset=fstr.tellp();
162 
163  fstr << "<TABLE BORDER WIDTH=100%>" << endl
164  << "<TR><TH COLSPAN=2>" << endl
165  << "CCCC Software Metrics Report";
166  if( prjptr->name(nlSIMPLE)!="" )
167  {
168  fstr << " on project " << prjptr->name(nlSIMPLE);
169  }
170  fstr << endl;
171 
172  // we have the option to disable the display of the generation time
173  // so that we can generate identical reports for regression testing
174  if(showGenTime==true)
175  {
176  time_t generationTime=time(NULL);
177  fstr << "<BR> generated " << ctime(&generationTime) << endl;
178  }
179 
180  fstr << "</TR>" << endl;
181 
182  if(report_mask & rtSUMMARY)
183  {
185  "Project Summary","projsum",
186  "Summary table of high level measures summed "
187  "over all files processed in the current run.");
188  number_of_report_parts++;
189  }
190 
191  if(report_mask & rtPROC1)
192  {
194  "Procedural Metrics Summary", "procsum",
195  "Table of procedural measures (i.e. lines of "
196  "code, lines of comment, McCabe's cyclomatic "
197  "complexity summed over each module.");
198  number_of_report_parts++;
199  }
200 
201  if(report_mask & rtPROC2)
202  {
204  "Procedural Metrics Detail", "procdet",
205  "The same procedural metrics as in the procedural "
206  "metrics summary, reported for individual "
207  "functions, grouped by module.");
208  number_of_report_parts++;
209  }
210 
211  if(report_mask & rtOODESIGN)
212  {
214  "Object Oriented Design","oodesign",
215  "Table of four of the 6 metrics proposed by "
216  "Chidamber and Kemerer in their various papers on "
217  "'a metrics suite for object oriented design'.");
218  number_of_report_parts++;
219  }
220 
221  if(report_mask & rtSTRUCT1)
222  {
224  "Structural Metrics Summary", "structsum",
225  "Structural metrics based on the relationships of "
226  "each module with others. Includes fan-out (i.e. "
227  "number of other modules the current module "
228  "uses), fan-in (number of other modules which use "
229  "the current module), and the Information Flow "
230  "measure suggested by Henry and Kafura, which "
231  "combines these to give a measure of coupling for "
232  "the module.");
233  number_of_report_parts++;
234  }
235 
236  if(report_mask & rtSTRUCT2)
237  {
239  "Structural Metrics Detail", "structdet",
240  "The names of the modules included as clients and "
241  "suppliers in the counts for the Structural "
242  "Metrics Summary.");
243  number_of_report_parts++;
244  }
245 
246  if(report_mask & rtOTHER)
247  {
249  "Other Extents", "other",
250  "Lexical counts for parts of submitted source "
251  "files which the analyser was unable to assign to "
252  "a module. Each record in this table relates to "
253  "either a part of the code which triggered a "
254  "parse failure, or to the residual lexical counts "
255  "relating to parts of a file not associated with "
256  "a specific module."
257  );
258  number_of_report_parts++;
259  }
260 
261  if(report_mask & rtCCCC)
262  {
264  "About CCCC", "infocccc",
265  "A description of the CCCC program.");
266  number_of_report_parts++;
267  }
268 
269  fstr << "</TR></TABLE>" << endl;
270  if(number_of_report_parts<2)
271  {
272  fstr.seekp(saved_stream_offset);
273  }
274 }
static CCCC_Project * prjptr
Definition: cccc_htm.h:53
void Put_Section_TOC_Entry(string section_name, string section_href, string section_description)
Definition: cccc_htm.cc:817
string name(int level) const
Definition: cccc_prj.cc:412
ofstream fstr
Definition: cccc_htm.h:50

Here is the call graph for this function:

Here is the caller graph for this function:

Friends And Related Function Documentation

CCCC_Html_Stream& operator<< ( CCCC_Html_Stream os,
const string &  stg 
)
friend

Definition at line 997 of file cccc_htm.cc.

998 {
999  // initialise a character pointer to the start of the string's buffer
1000  const char *cptr=stg.c_str();
1001  while(*cptr!='\000') {
1002  char c=*cptr;
1003 
1004  // the purpose of this is to filter out the characters which
1005  // must be escaped in HTML
1006  switch(c) {
1007  case '>': os.fstr << "&gt;" ; break;
1008  case '<': os.fstr << "&lt;" ; break;
1009  case '&': os.fstr << "&amp;"; break;
1010  // commas and parentheses do not need to be escaped, but
1011  // we want to allow line breaking just inside
1012  // parameter lists and after commas
1013  // we insert a non-breaking space to guarantee a small indent
1014  // on the new line, and one before the right parenthesis for
1015  // symmetry
1016  case ',': os.fstr << ", &nbsp;" ; break;
1017  case '(': os.fstr << "( &nbsp;" ; break;
1018  case ')': os.fstr << "&nbsp;)" ; break;
1019  default : os.fstr << c;
1020  }
1021  cptr++;
1022  }
1023  return os;
1024 }
ofstream fstr
Definition: cccc_htm.h:50
CCCC_Html_Stream& operator<< ( CCCC_Html_Stream os,
const CCCC_Metric mtc 
)
friend

Definition at line 1026 of file cccc_htm.cc.

1027 {
1028  const char *emphasis_prefix[]={"","<EM>","<STRONG>"};
1029  const char *emphasis_suffix[]={"","</EM>","</STRONG>"};
1030 
1031  // by writing to the underlying ostream object, we avoid the escape
1032  // functionality
1033  os.fstr << emphasis_prefix[mtc.emphasis_level()]
1034  << mtc.value_string()
1035  << emphasis_suffix[mtc.emphasis_level()];
1036  return os;
1037 }
EmphasisLevel emphasis_level() const
Definition: cccc_met.cc:85
string value_string() const
Definition: cccc_met.cc:116
ofstream fstr
Definition: cccc_htm.h:50

Member Data Documentation

ofstream CCCC_Html_Stream::fstr
private

Definition at line 50 of file cccc_htm.h.

string CCCC_Html_Stream::libdir
staticprivate

Definition at line 51 of file cccc_htm.h.

string CCCC_Html_Stream::outdir
staticprivate

Definition at line 52 of file cccc_htm.h.

CCCC_Project * CCCC_Html_Stream::prjptr
staticprivate

Definition at line 53 of file cccc_htm.h.


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