CCCC - C and C++ Code Counter  9999-git
CCCC Development version (post-3.1.4)
cccc_htm.h
Go to the documentation of this file.
1 /*
2  CCCC - C and C++ Code Counter
3  Copyright (C) 1994-2005 Tim Littlefair (tim_littlefair@hotmail.com)
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19 #ifndef __CCCC_HTM_H
20 #define __CCCC_HTM_H
21 
22 #include "cccc.h"
23 
24 #include <fstream>
25 
26 #include <time.h>
27 
28 #include "cccc_db.h"
29 #include "cccc_met.h"
30 
31 enum ReportType {
32  rtCONTENTS=0x0001, rtSUMMARY=0x0002,
33  rtOODESIGN=0x0004,
34  rtPROC1=0x0010, rtPROC2=0x0020,
35  rtSTRUCT1=0x0040, rtSTRUCT2=0x0080,
36  rtOTHER=0x0100,
38  rtSOURCE=0x0400,
40  rtCCCC=0x8000
41 };
42 
43 
46  const string& stg);
48  const CCCC_Metric& mtc);
49 
50  ofstream fstr;
51  static string libdir;
52  static string outdir;
54 
55  void Table_Of_Contents(int report_mask, bool showGenTime);
56  void Project_Summary();
57  void Procedural_Summary();
58  void Procedural_Detail();
59  void Structural_Summary();
60  void Structural_Detail();
61  void OO_Design();
62  void Other_Extents();
63  void Separate_Modules();
64  void Source_Listing();
65 
66 
67  void Module_Summary(CCCC_Module *module_ptr);
68  void Module_Detail(CCCC_Module *module_ptr);
69  void Procedural_Detail(CCCC_Module *module_ptr);
70  void Structural_Detail(CCCC_Module *module_ptr);
71 
72  void Separate_Module_Link(CCCC_Module *module_ptr);
73 
74  void Put_Section_Heading(string section_name,string section_tag,
75  int section_level);
76  void Put_Section_TOC_Entry(string section_name, string section_href,
77  string section_description);
78 
79  void Put_Header_Cell(string label, int width=0);
80  void Put_Label_Cell(string label, int width=0,
81  string ref_name="", string ref_href="",
82  CCCC_Record *rec_ptr=0);
83  void Put_Metric_Cell(const CCCC_Metric& metric, int width=0);
84  void Put_Metric_Cell(int count, string tag, int width=0);
85  void Put_Metric_Cell(int num, int denom, string tag, int width=0);
86  void Put_Extent_URL(const CCCC_Extent& extent);
87  void Put_Extent_Cell(const CCCC_Extent& extent, int width=0, bool withDescription=false);
88  void Put_Extent_List(CCCC_Record& record,bool withDescription=false);
90  CCCC_Project *prj,
91  int mask,
92  UserelNameLevel nl);
93 
94  void Metric_Description(string abbreviation,
95  string name,
96  string description);
97 
98  public:
99  static void GenerateReports(CCCC_Project* project, int report_mask,
100  const string& outfile, const string& outdir);
101 
102  // general-purpose constructor with standard preamble
103  CCCC_Html_Stream(const string& fname, const string& info);
104 
105  // destructor with standard trailer
107 };
108 
109 CCCC_Html_Stream& operator <<(CCCC_Html_Stream& os, const string& stg);
112 
113 // this class is added to support the generation of an HTML file
114 // containing the source analysed by the run, with anchors embedded at
115 // each of the lines referred to in the other parts of the report
117 {
118  // if this looks more like a struct to you, it does to me too...
119  // it could be embedded withing CCCC_Html_Stream except that this
120  // might make the default constructor unavailable for the std::map
121  // instantiation
122 
123  string file_;
124  int line_;
125  public:
126  Source_Anchor():line_(0) {}
127  Source_Anchor(string file, int line) : file_(file), line_(line) {}
128 
129  string get_file() const { return file_; }
130  int get_line() const { return line_; }
131  string key() const;
132 
133  void Emit_HREF(ofstream& fstr);
134  void Emit_NAME(ofstream& fstr);
135  void Emit_SPACE(ofstream& fstr);
136  // the default copy constructor, assignment operator and destructor
137  // are OK for this class
138 };
139 
140 #endif /* __CCCC_HTM_H */
141 
142 
143 
144 
145 
146 
147 
CCCC_Html_Stream(const string &fname, const string &info)
Definition: cccc_htm.cc:1343
Source_Anchor(string file, int line)
Definition: cccc_htm.h:127
int get_line() const
Definition: cccc_htm.h:130
void Put_Section_Heading(string section_name, string section_tag, int section_level)
Definition: cccc_htm.cc:276
void Table_Of_Contents(int report_mask, bool showGenTime)
Definition: cccc_htm.cc:154
void Structural_Summary()
Definition: cccc_htm.cc:562
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 Put_Section_TOC_Entry(string section_name, string section_href, string section_description)
Definition: cccc_htm.cc:817
void Structural_Detail()
Definition: cccc_htm.cc:723
static void GenerateReports(CCCC_Project *project, int report_mask, const string &outfile, const string &outdir)
Definition: cccc_htm.cc:55
friend CCCC_Html_Stream & operator<<(CCCC_Html_Stream &os, const string &stg)
Definition: cccc_htm.cc:997
void OO_Design()
Definition: cccc_htm.cc:426
void Procedural_Detail()
Definition: cccc_htm.cc:749
CCCC_Project * prj
Definition: ccccmain.cc:49
void Emit_SPACE(ofstream &fstr)
Definition: cccc_htm.cc:1506
UserelNameLevel
Definition: cccc_use.h:32
ReportType
Definition: cccc_htm.h:31
static string libdir
Definition: cccc_htm.h:51
void Put_Extent_URL(const CCCC_Extent &extent)
Definition: cccc_htm.cc:946
static string outdir
Definition: cccc_htm.h:52
string get_file() const
Definition: cccc_htm.h:129
void Put_Metric_Cell(const CCCC_Metric &metric, int width=0)
Definition: cccc_htm.cc:919
void Emit_HREF(ofstream &fstr)
Definition: cccc_htm.cc:1486
void Procedural_Summary()
Definition: cccc_htm.cc:505
void Put_Extent_List(CCCC_Record &record, bool withDescription=false)
Definition: cccc_htm.cc:980
void Metric_Description(string abbreviation, string name, string description)
Definition: cccc_htm.cc:1204
void Emit_NAME(ofstream &fstr)
Definition: cccc_htm.cc:1495
void Separate_Module_Link(CCCC_Module *module_ptr)
void Separate_Modules()
Definition: cccc_htm.cc:1039
void Module_Detail(CCCC_Module *module_ptr)
Definition: cccc_htm.cc:1105
void Put_Header_Cell(string label, int width=0)
Definition: cccc_htm.cc:829
void Other_Extents()
Definition: cccc_htm.cc:780
void Module_Summary(CCCC_Module *module_ptr)
Definition: cccc_htm.cc:1220
string file_
Definition: cccc_htm.h:123
void Source_Listing()
Definition: cccc_htm.cc:1382
void Project_Summary()
Definition: cccc_htm.cc:288
CCCC_Html_Stream & operator<<(CCCC_Html_Stream &os, const string &stg)
Definition: cccc_htm.cc:997
void Put_Structural_Details_Cell(CCCC_Module *mod, CCCC_Project *prj, int mask, UserelNameLevel nl)
Definition: cccc_htm.cc:653
ofstream fstr
Definition: cccc_htm.h:50
string key() const
Definition: cccc_htm.cc:1476
void Put_Extent_Cell(const CCCC_Extent &extent, int width=0, bool withDescription=false)
Definition: cccc_htm.cc:962