CCCC - C and C++ Code Counter  9999-git
CCCC Development version (post-3.1.4)
cccc_opt.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 // cccc_opt.h
20 #ifndef _CCCC_OPT_H
21 #define _CCCC_OPT_H
22 
23 // This file defines the object which holds the major configuration
24 // options for the CCCC program including:
25 // - the default language associated with each file name extension;
26 // - the treatment of specific values of each metric; and
27 // - the application of dialect specific parsing rule (e.g. rule to
28 // ignore MSVC++-specific pseudo-keywords when parsing the
29 // MS C++ dialect.
30 
31 // This is a natural singleton class, hence all member functions are static
32 // and all data will be declared with static file scope in the implementation
33 // file.
34 
35 #include "cccc.h"
36 #include "cccc_itm.h"
37 
38 class Metric_Treatment;
39 
41 {
42  public:
43  // initialise using a file
44  static void Load_Options(const string& filename);
45 
46  // initialise using hard-coded defaults
47  static void Load_Options();
48 
49  // save the current set of options to a file
50  static void Save_Options(const string& filename);
51 
52  // add a new option into the current option set
53  static void Add_Option(CCCC_Item& option_line);
54 
55  // map a filename to a language
56  static string getFileLanguage(const string& filename);
57 
58  // map a metric name to a Metric_Treatment object
59  static Metric_Treatment *getMetricTreatment(const string& metric_tag);
60 
61  // the following function allows the parser to use special
62  // handling rules for identifiers in particular situations
63  // (especially pseudo-keywords like BEGIN_MESSAGE_MAP)
64  static string dialectKeywordPolicy(const string& lang, const string& kw);
65 };
66 
67 #endif
68 
69 
70 
71 
72 
73 
74 
static void Save_Options(const string &filename)
Definition: cccc_opt.cc:118
static void Load_Options()
Definition: cccc_opt.cc:182
static string dialectKeywordPolicy(const string &lang, const string &kw)
Definition: cccc_opt.cc:264
static string getFileLanguage(const string &filename)
Definition: cccc_opt.cc:220
static Metric_Treatment * getMetricTreatment(const string &metric_tag)
Definition: cccc_opt.cc:253
static void Add_Option(CCCC_Item &option_line)
Definition: cccc_opt.cc:90