File: cccc_opt.h

package info (click to toggle)
cccc 3.pre81-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,820 kB
  • ctags: 4,972
  • sloc: ansic: 33,244; cpp: 10,691; java: 618; makefile: 165; sh: 11
file content (56 lines) | stat: -rw-r--r-- 1,563 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// cccc_opt.h
#ifndef _CCCC_OPT_H
#define _CCCC_OPT_H

// This file defines the object which holds the major configuration
// options for the CCCC program including:
//  - the default language associated with each file name extension; 
//  - the treatment of specific values of each metric; and
//  - the application of dialect specific parsing rule (e.g. rule to 
//    ignore MSVC++-specific pseudo-keywords when parsing the 
//    MS C++ dialect.

// This is a natural singleton class, hence all member functions are static
// and all data will be declared with static file scope in the implementation
// file.

#include "cccc.h"
#include "cccc_itm.h"

class Metric_Treatment;

class CCCC_Options
{
 public:
  // initialise using a file
  static void Load_Options(const string& filename);

  // initialise using hard-coded defaults
  static void Load_Options();

  // save the current set of options to a file
  static void Save_Options(const string& filename);

  // add a new option into the current option set
  static void Add_Option(CCCC_Item& option_line);

  // map a filename to a language
  static string getFileLanguage(const string& filename);
  
  // map a metric name to a Metric_Treatment object
  static Metric_Treatment *getMetricTreatment(const string& metric_tag);

  // the following function allows the parser to use special 
  // handling rules for identifiers in particular situations
  // (especially pseudo-keywords like BEGIN_MESSAGE_MAP)
  static string dialectKeywordPolicy(const string& lang, const string& kw);
};

#endif