~ubuntu-branches/ubuntu/jaunty/aspectc++/jaunty

« back to all changes in this revision

Viewing changes to Puma/gen-release/step1/inc/Puma/CTranslationUnit.h

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-07-07 14:41:02 UTC
  • mfrom: (1.1.3 upstream) (6.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080707144102-lzml7t07f3sl00r5
Tags: 1.0pre4~svn.20080711-1
* new upstream snapshot.
* include all upstream documentation. Clarifying emails regarding
  licensing has been included into debian/copyright.
* reformat description following recomendations of
  http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description
  (Closes: #480316)

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#ifndef __CTranslationUnit__
20
20
#define __CTranslationUnit__
21
21
 
22
 
#include "Puma/CClassDatabase.h"
 
22
/** \file
 
23
 *  Abstraction of a translation unit. */
 
24
 
 
25
#include "Puma/CSemDatabase.h"
23
26
#include "Puma/UnitManager.h"
24
27
#include "Puma/CProject.h"
25
28
#include "Puma/Builder.h"
31
34
class CTree;
32
35
class PreTree;
33
36
 
 
37
 
 
38
/** \class CTranslationUnit CTranslationUnit.h Puma/CTranslationUnit.h
 
39
 *  Abstraction of a translation unit. A translation unit is a 
 
40
 *  single implementation file that a compiler can translate 
 
41
 *  to an object file. In particular it contains all the code 
 
42
 *  from included header files. 
 
43
 *
 
44
 *  A translation unit is created by the parser (see Puma::Parser).
 
45
 *  It encapsulates the input file and the parse results (syntax
 
46
 *  trees, semantic database). When it is destroyed, it also destroys
 
47
 *  the parse results. */
34
48
class CTranslationUnit {
35
49
  Unit *_unit;
36
50
  CTree *_syntax_tree;
37
51
  PreTree *_cpp_tree;
38
 
  CClassDatabase _class_db;
 
52
  CSemDatabase _class_db;
39
53
  UnitManager _local_units;
40
54
 
41
55
public:
 
56
  /** Constructor.
 
57
   *  \param u The token unit of the input file. 
 
58
   *  \param p The project information object. */
42
59
  CTranslationUnit (Unit &u, CProject &p) :
43
60
    _unit (&u),
44
61
    _syntax_tree ((CTree*)0),
45
62
    _cpp_tree ((PreTree*)0),
46
63
    _class_db (p),
47
64
    _local_units (p.err ()) {}
 
65
  /** Destructor. Destroys the C/C++ syntax tree and the
 
66
   *  preprocessor syntax tree. The semantic information
 
67
   *  objects are destroyed when the semantic database 
 
68
   *  member object is destroyed. */
48
69
  ~CTranslationUnit () 
49
70
    { destroy (_syntax_tree); destroy (_cpp_tree); }
50
71
 
 
72
  /** Set the C/C++ syntax tree. 
 
73
   *  \param t The root node of the syntax tree. */
51
74
  void tree (CTree *t) { _syntax_tree = t; }
 
75
  /** Set the preprocessor syntax tree.
 
76
   *  \param t The root node of the syntax tree. */
52
77
  void cpp_tree (PreTree *t) { _cpp_tree = t; }
53
78
 
 
79
  /** Get the C/C++ syntax tree. */
54
80
  CTree *tree () const { return _syntax_tree; }
 
81
  /** Get the C preprocessor syntax tree. */
55
82
  PreTree *cpp_tree () const { return _cpp_tree; }
56
83
 
 
84
  /** Get the token unit of the input file. */
57
85
  Unit *unit () const { return _unit; }
58
 
  CClassDatabase &db () const { return (CClassDatabase&)_class_db; }
 
86
  /** Get the semantic information database. */
 
87
  CSemDatabase &db () const { return (CSemDatabase&)_class_db; }
 
88
  /** Get the unit manager for local units (macro expansions etc). */
59
89
  UnitManager &local_units () const { return (UnitManager&)_local_units; }
60
90
 
61
91
private: