CCCC - C and C++ Code Counter  9999-git
CCCC Development version (post-3.1.4)
cccc_prj.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 /*
20  * cccc_prj.h
21  */
22 #ifndef CCCC_PRJ_H
23 #define CCCC_PRJ_H
24 
25 #include "cccc_rec.h"
26 
27 // forward declarations
28 class CCCC_Item;
29 class CCCC_Record;
30 class CCCC_Project;
31 class CCCC_Module;
32 class CCCC_Member;
34 class CCCC_Extent;
35 
36 static const string REJEXT_PREFIX="CCCC_RejExt";
37 
39 {
40  rmeCLIENT=0x01, rmeSUPPLIER=0x02,
43 };
44 
45 class CCCC_Project : public CCCC_Record
46 {
47  friend class CCCC_Html_Stream;
48  friend class CCCC_Xml_Stream;
49  friend class CCCC_Module;
50  friend class CCCC_Member;
51  friend class CCCC_UseRelationship;
52  friend class CCCC_Extent;
53 
58 
59  std::map<string, CCCC_Item> OptionTable;
60 
61 
62  public: // because MSVC++ version of STL needs it to be...
63 
64  // we need a record of which extents came from which files
65  // so that when we implement persistence, we can purge
66  // extent records from each file as we re-analyze it
68  {
71  ExtentTableEntry() : table_ptr(NULL), extent_ptr(NULL) {}
72  };
73  typedef std::multimap<string, ExtentTableEntry> FileExtentTable;
74  FileExtentTable file_extent_table;
75 
76  public:
77  CCCC_Project(const string& name="");
78 
79  // these functions are used in both the analyzer
80  // and the load side of the persistence code
81  // to add entities to the project
82  void add_module(CCCC_Item& module_data_line);
83  void add_member(CCCC_Item& member_data_line);
84  void add_userel(CCCC_Item& use_data_line);
85  void add_rejected_extent(CCCC_Item& rejected_data_line);
86 
87  // this function is used after loading and/or analysis
88  // has been completed to (re)create the maps owned by
89  // each module of its members and relationships
90  void reindex();
91 
92  int get_count(const char *count_tag);
93 
94  string name(int level) const;
95 
96  int FromFile(ifstream& infile);
97  int ToFile(ofstream& outfile);
98 
99  void set_option(string key, CCCC_Item& option_data_line);
100  int get_option(string key, CCCC_Item& option_data_line);
101 };
102 
103 #endif // CCCC_PRJ_H
104 
105 
106 
107 
108 
109 
110 
111 
112 
113 
114 
CCCC_Table< CCCC_Module > module_table
Definition: cccc_prj.h:54
virtual string key() const
Definition: cccc_rec.cc:76
RelationshipMaskElements
Definition: cccc_prj.h:38
CCCC_Table< CCCC_Member > member_table
Definition: cccc_prj.h:55
int get_option(string key, CCCC_Item &option_data_line)
CCCC_Table< CCCC_Extent > rejected_extent_table
Definition: cccc_prj.h:57
std::multimap< string, ExtentTableEntry > FileExtentTable
Definition: cccc_prj.h:73
void add_rejected_extent(CCCC_Item &rejected_data_line)
Definition: cccc_prj.cc:145
CCCC_Table< CCCC_Extent > * table_ptr
Definition: cccc_prj.h:69
int FromFile(ifstream &infile)
Definition: cccc_prj.cc:364
void reindex()
Definition: cccc_prj.cc:151
void add_module(CCCC_Item &module_data_line)
Definition: cccc_prj.cc:56
FileExtentTable file_extent_table
Definition: cccc_prj.h:74
void set_option(string key, CCCC_Item &option_data_line)
static const string REJEXT_PREFIX
Definition: cccc_prj.h:36
string name(int level) const
Definition: cccc_prj.cc:412
void add_member(CCCC_Item &member_data_line)
Definition: cccc_prj.cc:88
CCCC_Table< CCCC_UseRelationship > userel_table
Definition: cccc_prj.h:56
int ToFile(ofstream &outfile)
Definition: cccc_prj.cc:317
int get_count(const char *count_tag)
Definition: cccc_prj.cc:308
CCCC_Project(const string &name="")
Definition: cccc_prj.cc:33
void add_userel(CCCC_Item &use_data_line)
Definition: cccc_prj.cc:125
std::map< string, CCCC_Item > OptionTable
Definition: cccc_prj.h:59