Debian Codegraph @

kwsGenerator.h

raw
1 /*=========================================================================
2
3 Program: KWStyle - Kitware Style Checker
4 Module: kwsGenerator.h
5
6 Copyright (c) Kitware, Inc. All rights reserved.
7 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notices for more information.
12
13 =========================================================================*/
14 #ifndef kwsGenerator_h
15 #define kwsGenerator_h
16
17 #include "kwsParser.h"
18 #include <iostream>
19 #include <fstream>
20 #include <stdio.h>
21 #include <vector>
22 #include <kwssys/SystemTools.hxx>
23
24 namespace kws
25 {
26 const char ErrorColor[NUMBER_ERRORS][8] = {
27 {'#','F','F','C','C','3','3','\0'},
28 {'#','F','F','C','C','6','6','\0'},
29 {'#','F','F','F','F','6','6','\0'},
30 {'#','6','6','6','6','C','C','\0'},
31 {'#','F','F','F','F','6','6','\0'},
32 {'#','6','6','6','6','C','C','\0'},
33 {'#','9','9','F','F','C','C','\0'},
34 {'#','9','9','C','C','F','F','\0'},
35 {'#','6','6','6','6','C','C','\0'},
36 {'#','F','F','C','C','3','3','\0'},
37 {'#','F','F','C','C','3','3','\0'},
38 {'#','F','F','C','C','3','3','\0'},
39 {'#','F','F','9','9','C','C','\0'},
40 {'#','F','F','9','9','C','C','\0'},
41 {'#','F','F','3','3','0','0','\0'},
42 {'#','0','0','a','a','0','0','\0'},
43 {'#','6','6','0','0','3','3','\0'},
44 {'#','9','9','C','C','F','F','\0'},
45 {'#','9','9','C','C','F','F','\0'},
46 {'#','9','9','C','C','F','F','\0'},
47 {'#','6','6','C','C','C','C','\0'},
48 {'#','6','6','6','6','C','C','\0'},
49 {'#','0','0','0','0','F','F','\0'},
50 {'#','0','0','0','0','F','F','\0'},
51 {'#','D','4','D','0','C','8','\0'},
52 {'#','F','F','F','F','C','C','\0'},
53 {'#','9','9','C','C','C','C','\0'},
54 {'#','C','C','C','C','F','F','\0'},
55 {'#','9','9','C','C','C','C','\0'},
56 {'#','F','F','3','3','0','0','\0'},
57 {'#','9','9','C','C','C','C','\0'},
58 {'#','F','F','3','3','0','0','\0'}
59 };
60
61 class Generator
62 {
63 public:
64
65 typedef std::vector<Parser> ParserVectorType;
66
67 /** Constructor */
68 Generator();
69
70 /** Destructor */
71 ~Generator();
72
73 /** Set the buffer to analyze */
74 void SetParser(ParserVectorType* parsers)
75 {
76 m_Parsers = parsers;
77 }
78
79 /** Generate the HTML files */
80 bool GenerateHTML(const char* dir,bool showAllErrors = true);
81
82 /** Export the HTML report */
83 void ExportHTML(std::ostream & output);
84
85 /** Generate dart files */
86 bool GenerateDart(const char *dir, int maxError = -1, bool group = false,
87 std::string url = "", double time = 0,
88 std::string basedirectory = "");
89
90 /** Generate a simple XML report of the errors */
91 bool ExportXML(const char* filename);
92
93 /** Set the configuration file */
94 void ReadConfigurationFile(const char* configFile);
95
96 private:
97
98 bool CreateHeader(std::ostream * file,const char* title);
99 bool CreateFooter(std::ostream * file);
100 bool GenerateMatrix(const char* dir,bool showAllErrors);
101 bool GenerateDescription(const char* dir);
102
103 ParserVectorType* m_Parsers;
104 std::string m_ProjectTitle;
105 std::string m_ProjectLogo;
106 std::string m_KWStyleLogo;
107 unsigned int m_MaxDirectoryDepth;
108 unsigned int m_ErrorThreshold;
109 };
110
111 } // end namespace kws
112
113 #endif