CCCC - C and C++ Code Counter  9999-git
CCCC Development version (post-3.1.4)
cccc_xml.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_XML_H
20 #define __CCCC_XML_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 // Ideally, this class would be defined to reuse common
32 // facilities abstracted from CCCC_Html_Stream.
33 // This may happen in the future, for the moment, the implementation
34 // has been created by cut and paste.
35 
36 // We need to include cccc_htm.h because it defines the enumeration
37 // ReportType.
38 #include "cccc_htm.h"
39 
40 
43  const string& stg);
45  const CCCC_Metric& mtc);
46 
47  ofstream fstr;
48  static string libdir;
49  static string outdir;
51 
52  void Timestamp();
53  void Project_Summary();
54  void Procedural_Summary();
55  void Procedural_Detail();
56  void Structural_Summary();
57  void Structural_Detail();
58  void OO_Design();
59  void Other_Extents();
60  void Separate_Modules();
61  void Source_Listing();
62 
63 
64  void Module_Summary(CCCC_Module *module_ptr);
65  void Module_Detail(CCCC_Module *module_ptr);
66  void Procedural_Detail(CCCC_Module *module_ptr);
67  void Structural_Detail(CCCC_Module *module_ptr);
68 
69  void Separate_Module_Link(CCCC_Module *module_ptr);
70 
71  void Put_Label_Node(string nodeTag, string label, int width=0,
72  string ref_name="", string ref_href="",
73  CCCC_Record *rec_ptr=0);
74  void Put_Metric_Node(string nodeTag, const CCCC_Metric& metric);
75  void Put_Metric_Node(string nodeTag, int count, string tag);
76  void Put_Metric_Node(string nodeTag, int num, int denom, string tag);
77  void Put_Extent_URL(const CCCC_Extent& extent);
78  void Put_Extent_Node(const CCCC_Extent& extent, int width=0, bool withDescription=false);
79  void Put_Extent_List(CCCC_Record& record,bool withDescription=false);
81  CCCC_Project *prj,
82  int mask,
83  UserelNameLevel nl);
84 
85  public:
86  static void GenerateReports(CCCC_Project* project, int report_mask,
87  const string& outfile, const string& outdir);
88 
89  // general-purpose constructor with standard preamble
90  CCCC_Xml_Stream(const string& fname, const string& info);
91 
92  // destructor with standard trailer
94 };
95 
96 CCCC_Xml_Stream& operator <<(CCCC_Xml_Stream& os, const string& stg);
99 
100 #if 0
101 // this class is added to support the generation of an HTML file
102 // containing the source analysed by the run, with anchors embedded at
103 // each of the lines referred to in the other parts of the report
104 class Source_Anchor
105 {
106  // if this looks more like a struct to you, it does to me too...
107  // it could be embedded withing CCCC_Xml_Stream except that this
108  // might make the default constructor unavailable for the std::map
109  // instantiation
110 
111  string file_;
112  int line_;
113  public:
114  Source_Anchor():line_(0) {}
115  Source_Anchor(string file, int line) : file_(file), line_(line) {}
116 
117  string get_file() const { return file_; }
118  int get_line() const { return line_; }
119  string key() const;
120 
121  void Emit_HREF(ofstream& fstr);
122  void Emit_NAME(ofstream& fstr);
123  void Emit_SPACE(ofstream& fstr);
124  // the default copy constructor, assignment operator and destructor
125  // are OK for this class
126 };
127 #endif
128 
129 #endif /* __CCCC_XML_H */
130 
131 
132 
133 
134 
135 
136 
void Put_Extent_URL(const CCCC_Extent &extent)
Definition: cccc_xml.cc:567
int get_line() const
Definition: cccc_htm.h:130
void Put_Structural_Details_Node(CCCC_Module *mod, CCCC_Project *prj, int mask, UserelNameLevel nl)
Definition: cccc_xml.cc:383
void Module_Summary(CCCC_Module *module_ptr)
Definition: cccc_xml.cc:784
void Procedural_Detail()
Definition: cccc_xml.cc:463
static string libdir
Definition: cccc_xml.h:48
static string outdir
Definition: cccc_xml.h:49
void Timestamp()
Definition: cccc_xml.cc:229
CCCC_Project * prj
Definition: ccccmain.cc:49
void Emit_SPACE(ofstream &fstr)
Definition: cccc_htm.cc:1506
UserelNameLevel
Definition: cccc_use.h:32
void Put_Label_Node(string nodeTag, string label, int width=0, string ref_name="", string ref_href="", CCCC_Record *rec_ptr=0)
Definition: cccc_xml.cc:507
void Project_Summary()
Definition: cccc_xml.cc:238
void Structural_Detail()
Definition: cccc_xml.cc:448
void Other_Extents()
Definition: cccc_xml.cc:487
CCCC_Xml_Stream(const string &fname, const string &info)
Definition: cccc_xml.cc:207
string get_file() const
Definition: cccc_htm.h:129
void Emit_HREF(ofstream &fstr)
Definition: cccc_htm.cc:1486
void OO_Design()
Definition: cccc_xml.cc:270
static void GenerateReports(CCCC_Project *project, int report_mask, const string &outfile, const string &outdir)
Definition: cccc_xml.cc:147
CCCC_Xml_Stream & operator<<(CCCC_Xml_Stream &os, const string &stg)
Definition: cccc_xml.cc:615
void Emit_NAME(ofstream &fstr)
Definition: cccc_htm.cc:1495
ofstream fstr
Definition: cccc_xml.h:47
void Procedural_Summary()
Definition: cccc_xml.cc:304
void Separate_Module_Link(CCCC_Module *module_ptr)
void Source_Listing()
Definition: cccc_xml.cc:831
void Structural_Summary()
Definition: cccc_xml.cc:340
friend CCCC_Xml_Stream & operator<<(CCCC_Xml_Stream &os, const string &stg)
Definition: cccc_xml.cc:615
string file_
Definition: cccc_htm.h:123
void Put_Extent_Node(const CCCC_Extent &extent, int width=0, bool withDescription=false)
Definition: cccc_xml.cc:580
void Put_Extent_List(CCCC_Record &record, bool withDescription=false)
Definition: cccc_xml.cc:592
void Put_Metric_Node(string nodeTag, const CCCC_Metric &metric)
Definition: cccc_xml.cc:544
static CCCC_Project * prjptr
Definition: cccc_xml.h:50
void Separate_Modules()
Definition: cccc_xml.cc:643
void Module_Detail(CCCC_Module *module_ptr)
Definition: cccc_xml.cc:698
string key() const
Definition: cccc_htm.cc:1476