File: ACConfig.h

package info (click to toggle)
aspectc%2B%2B 1.0pre4~svn.20090918-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 117,308 kB
  • ctags: 410,601
  • sloc: cpp: 1,883,007; ansic: 17,279; sh: 2,190; makefile: 1,088
file content (121 lines) | stat: -rw-r--r-- 4,227 bytes parent folder | download
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// This file is part of the AspectC++ compiler 'ac++'.
// Copyright (C) 1999-2003  The 'ac++' developers (see aspectc.org)
//                                                                
// This program is free software;  you can redistribute it and/or 
// modify it under the terms of the GNU General Public License as 
// published by the Free Software Foundation; either version 2 of 
// the License, or (at your option) any later version.            
//                                                                
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of 
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
// GNU General Public License for more details.                   
//                                                                
// You should have received a copy of the GNU General Public      
// License along with this program; if not, write to the Free     
// Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
// MA  02111-1307  USA                                            

#ifndef __ACConfig_h__
#define __ACConfig_h__

// C++ includes
#include <iostream>
#include <string>
using namespace std;

// PUMA includes
#include "Puma/Array.h"
using namespace Puma;

// Aspect C++ includes
#include "ACProject.h"

class ACConfig {
  ACProject &_project;
  int _argc;
  char **_argv;

  // analysis results
  int _v;
  const char *_file_in;
  const char *_file_out;
  const char *_repository;
  bool _ifiles;
  bool _iterate_tunits;
  bool _nosave;
  bool _noline;
  Array<const char*> _aspect_headers;
  bool _iterate_aspects;
  bool _problem_local_class;
  bool _problem_spec_scope;
  bool _problem_force_inline;
  string _size_type;
  string _project_id;
  string _proj_file;
  bool _warn_deprecated;
  bool _warn_macro;
  bool _dynamic;
  bool _introspection;
  
public:

  enum {
    ACOPT_VERBOSE=1, ACOPT_VERSION, ACOPT_COMPILE, ACOPT_OUTPUT, 
    ACOPT_INCLUDE_FILES, ACOPT_NOSAVE, ACOPT_ASPECT_HEADER,
	  ACOPT_REPOSITORY, ACOPT_NOLINE,
    ACOPT_PROBLEM_LOCAL_CLASS, ACOPT_NO_PROBLEM_LOCAL_CLASS,
    ACOPT_PROBLEM_SPEC_SCOPE, ACOPT_NO_PROBLEM_SPEC_SCOPE,
    ACOPT_PROBLEM_FORCE_INLINE, ACOPT_NO_PROBLEM_FORCE_INLINE,
    ACOPT_GEN_SIZE_TYPE, ACOPT_PROJ_FILE,
    ACOPT_WARN_DEPRECATED, ACOPT_NO_WARN_DEPRECATED,
    ACOPT_WARN_MACRO, ACOPT_NO_WARN_MACRO,
    ACOPT_KEYWORDS, ACOPT_DYNAMIC, ACOPT_INTROSPECTION };

  ACConfig (ACProject &project, int argc, char** argv) :
    _project (project), _argc (argc), _argv (argv) {}
  ~ACConfig ();
  
  // analyze the command line arguments
  bool analyze ();

  // get file default cc file extension
  const char *extension ();

  // get the associated ACProject
  ACProject &project () const { return _project; }
  
  // get the analysis results
  int verbose () const { return _v; }
  const char *file_in () const { return _file_in; }
  const char *file_out () const { return _file_out; }
  bool ifiles () const { return _ifiles; }
  bool iterate () const { return _iterate_tunits; }
  bool nosave () const { return _nosave; }
  bool noline () const { return _noline; }
  bool iterate_aspects () const { return _iterate_aspects; }
  int aspect_headers () const { return _aspect_headers.length (); }
  const char *aspect_header (int i) const {
    return _aspect_headers.lookup (i);
  }
  const char *repository () const { return _repository; }
  bool problem_local_class () const { return _problem_local_class; }
  bool problem_spec_scope () const { return _problem_spec_scope; }
  bool problem_force_inline () const { return _problem_force_inline; }
  string size_type () const { return _size_type; }
  string project_id () const { return _project_id; }
  string proj_file () const { return _proj_file; }
  bool warn_deprecated () const { return _warn_deprecated; }
  bool warn_macro () const { return _warn_macro; }
  bool dynamic () const { return _dynamic; }
  bool introspection () const { return _introspection; }
  
private:
  // print a usage message
  void usage (const char *) const;

  // get the error stream of the project
  ErrorStream &err () const { return _project.err (); }
};

#endif // __ACConfig_h__