1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
|
#ifndef __CCCC_HTM_H
#define __CCCC_HTM_H
#include "cccc.h"
#include <fstream>
#include <time.h>
#include "cccc_db.h"
#include "cccc_met.h"
enum ReportType {
rtCONTENTS=0x0001, rtSUMMARY=0x0002,
rtOODESIGN=0x0004,
rtPROC1=0x0010, rtPROC2=0x0020,
rtSTRUCT1=0x0040, rtSTRUCT2=0x0080,
rtOTHER=0x0100,
rtSEPARATE_MODULES=0x0200,
rtSOURCE=0x0400,
rtSHOW_GEN_TIME=0x800,
rtCCCC=0x8000
};
class CCCC_Html_Stream {
friend CCCC_Html_Stream& operator <<(CCCC_Html_Stream& os,
const string& stg);
friend CCCC_Html_Stream& operator <<(CCCC_Html_Stream& os,
const CCCC_Metric& mtc);
ofstream fstr;
static string libdir;
static string outdir;
static CCCC_Project* prjptr;
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);
public:
static void GenerateReports(CCCC_Project* project, int report_mask,
const string& outfile, const string& outdir);
// general-purpose constructor with standard preamble
CCCC_Html_Stream(const string& fname, const string& info);
// destructor with standard trailer
~CCCC_Html_Stream();
};
CCCC_Html_Stream& operator <<(CCCC_Html_Stream& os, const string& stg);
CCCC_Html_Stream& operator <<(CCCC_Html_Stream& os, const CCCC_Metric& mtc);
CCCC_Html_Stream& operator <<(CCCC_Html_Stream& os, const CCCC_Extent& ext);
// this class is added to support the generation of an HTML file
// containing the source analysed by the run, with anchors embedded at
// each of the lines referred to in the other parts of the report
class Source_Anchor
{
// if this looks more like a struct to you, it does to me too...
// it could be embedded withing CCCC_Html_Stream except that this
// might make the default constructor unavailable for the std::map
// instantiation
string file_;
int line_;
public:
Source_Anchor():line_(0) {}
Source_Anchor(string file, int line) : file_(file), line_(line) {}
string get_file() const { return file_; }
int get_line() const { return line_; }
string key() const;
void Emit_HREF(ofstream& fstr);
void Emit_NAME(ofstream& fstr);
void Emit_SPACE(ofstream& fstr);
// the default copy constructor, assignment operator and destructor
// are OK for this class
};
#endif /* __CCCC_HTM_H */
|