51 file_extension_language_map_t::value_type extension_pair(ext,lang);
59 metric_treatment_map_t::iterator iter=
64 delete (*iter).second;
65 (*iter).second=new_treatment;
69 metric_treatment_map_t::value_type
70 treatment_pair(new_treatment->
code,new_treatment);
77 string dialect, keyword, policy;
79 dialect_keyword_line.
Extract(dialect) &&
80 dialect_keyword_line.
Extract(keyword) &&
81 dialect_keyword_line.
Extract(policy)
84 dialect_keyword_map_t::key_type kt(dialect,keyword);
85 dialect_keyword_map_t::value_type vt(kt,policy);
93 bool retval=option.
Extract(first_token);
99 else if(first_token==
"CCCC_FileExt")
103 else if(first_token==
"CCCC_MetTmnt")
107 else if(first_token==
"CCCC_Dialect")
120 ofstream optstr(filename.c_str());
121 file_extension_language_map_t::iterator felIter;
127 extLine.
Insert(
"CCCC_FileExt");
128 extLine.
Insert((*felIter).first.c_str());
129 extLine.
Insert((*felIter).second.c_str());
133 metric_treatment_map_t::iterator tIter;
139 tmtLine.
Insert(
"CCCC_MetTmnt");
140 tmtLine.
Insert((*tIter).second->code);
141 tmtLine.
Insert((*tIter).second->lower_threshold);
142 tmtLine.
Insert((*tIter).second->upper_threshold);
143 tmtLine.
Insert((*tIter).second->numerator_threshold);
144 tmtLine.
Insert((*tIter).second->width);
145 tmtLine.
Insert((*tIter).second->precision);
146 tmtLine.
Insert((*tIter).second->name);
150 dialect_keyword_map_t::iterator dkIter;
156 dkLine.
Insert(
"CCCC_Dialect");
157 dkLine.
Insert((*dkIter).first.first);
158 dkLine.
Insert((*dkIter).first.second);
159 dkLine.
Insert((*dkIter).second);
166 ifstream optstr(filename.c_str());
186 const char **option_ptr;
189 while( (*option_ptr)!=NULL)
191 string option_string=
"CCCC_FileExt@";
192 option_string+=(*option_ptr);
199 while( (*option_ptr)!=NULL)
201 string option_string=
"CCCC_MetTmnt@";
202 option_string+=(*option_ptr);
209 while( (*option_ptr)!=NULL)
211 string option_string=
"CCCC_Dialect@";
212 option_string+=(*option_ptr);
224 file_extension_language_map_t::iterator iter;
226 unsigned int extpos=filename.rfind(
".");
227 if(extpos!=string::npos)
229 extension=filename.substr(extpos);
233 retval=(*iter).second;
241 retval=(*iter).second;
246 cerr <<
"No language found for extension " << extension.c_str() << endl;
256 metric_treatment_map_t::iterator iter=
treatment_map.find(metric_tag);
259 retval=(*iter).second;
267 dialect_keyword_map_t::key_type kt(lang,kw);
271 retval=(*iter).second;
359 "LOCf@ 30@ 100@ 0@ 6@ 0@Lines of code/function@",
360 "LOCm@ 500@ 2000@ 0@ 6@ 0@Lines of code/single module@",
361 "LOCper@ 500@ 2000@ 0@ 6@ 3@Lines of code/average module@",
362 "LOCp@ 999999@ 999999@ 0@ 6@ 0@Lines of code/project@",
363 "MVGf@ 10@ 30@ 0@ 6@ 0@Cyclomatic complexity/function@",
364 "MVGm@ 200@ 1000@ 0@ 6@ 0@Cyclomatic complexity/single module@",
365 "MVGper@ 200@ 1000@ 0@ 6@ 3@Cyclomatic complexity/average module@",
366 "MVGp@ 999999@ 999999@ 0@ 6@ 0@Cyclomatic complexity/project@",
367 "COM@ 999999@ 999999@ 0@ 6@ 0@Comment lines@",
368 "COMper@999999@ 999999@ 0@ 6@ 3@Comment lines (averaged)@",
369 "M_C@ 5@ 10@ 5@ 6@ 3@MVG/COM McCabe/comment line@",
370 "L_C@ 7@ 30@ 20@ 6@ 3@LOC/COM Lines of code/comment line@",
371 "FI@ 12@ 20@ 0@ 6@ 0@Fan in (overall)@",
372 "FIv@ 6@ 12@ 0@ 6@ 0@Fan in (visible uses only)@",
373 "FIc@ 6@ 12@ 0@ 6@ 0@Fan in (concrete uses only)@",
374 "FO@ 12@ 20@ 0@ 6@ 0@Fan out (overall)@",
375 "FOv@ 6@ 12@ 0@ 6@ 0@Fan out (visible uses only)@",
376 "FOc@ 6@ 12@ 0@ 6@ 0@Fan out (concrete uses only)@",
377 "IF4@ 100@ 1000@ 0@ 6@ 0@Henry-Kafura/Shepperd measure (overall)@",
378 "IF4v@ 30@ 100@ 0@ 6@ 0@Henry-Kafura/Shepperd measure (visible)@",
379 "IF4c@ 30@ 100@ 0@ 6@ 0@Henry-Kafura/Shepperd measure (concrete)@",
382 "WMC1@ 30@ 100@ 0@ 6@ 0@Weighting function=1 unit per method@",
383 "WMCv@ 10@ 30@ 0@ 6@ 0@Weighting function=1 unit per visible method@",
384 "DIT@ 3@ 6@ 0@ 6@ 0@Depth of Inheritance Tree@",
385 "NOC@ 4@ 15@ 0@ 6@ 0@Number of children@",
386 "CBO@ 12@ 30@ 0@ 6@ 0@Coupling between objects@",
387 "8.3@ 999999@ 999999@ 0@ 8@ 3@General format for fixed precision 3 d.p.@",
408 "c++.mfc@BEGIN_MESSAGE_MAP@start_skipping@",
409 "c++.mfc@END_MESSAGE_MAP@stop_skipping@",
410 "c++.stl@__STL_BEGIN_NAMESPACE@ignore@",
411 "c++.stl@__STL_END_NAMESPACE@ignore@",
static void Save_Options(const string &filename)
const char * default_treatment_options[]
static void add_file_extension(CCCC_Item &fileext_line)
bool Insert(const string &s)
static file_extension_language_map_t extension_map
void add_treatment(CCCC_Item &treatment_line)
const char * default_dialect_options[]
std::map< string, string > file_extension_language_map_t
std::pair< string, string > dialect_keyword_t
static void add_dialect_keyword(CCCC_Item &dialect_keyword_line)
static void Load_Options()
static string dialectKeywordPolicy(const string &lang, const string &kw)
static dialect_keyword_map_t dialect_keyword_map
bool FromFile(ifstream &ifstr)
static metric_treatment_map_t treatment_map
static string getFileLanguage(const string &filename)
static Metric_Treatment * getMetricTreatment(const string &metric_tag)
std::map< dialect_keyword_t, string > dialect_keyword_map_t
std::map< string, Metric_Treatment * > metric_treatment_map_t
static void Add_Option(CCCC_Item &option_line)
const char * default_fileext_options[]
bool ToFile(ofstream &ofstr)