~ubuntu-branches/ubuntu/natty/aspectc++/natty

« back to all changes in this revision

Viewing changes to Puma/src/infos/CRecord.cc

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2005-12-23 10:49:40 UTC
  • Revision ID: james.westby@ubuntu.com-20051223104940-ig4klhoi991zs7km
Tags: upstream-0.99+1.0pre2
ImportĀ upstreamĀ versionĀ 0.99+1.0pre2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// This file is part of PUMA.
 
2
// Copyright (C) 1999-2003  The PUMA developer team.
 
3
//                                                                
 
4
// This program is free software;  you can redistribute it and/or 
 
5
// modify it under the terms of the GNU General Public License as 
 
6
// published by the Free Software Foundation; either version 2 of 
 
7
// the License, or (at your option) any later version.            
 
8
//                                                                
 
9
// This program is distributed in the hope that it will be useful,
 
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of 
 
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
 
12
// GNU General Public License for more details.                   
 
13
//                                                                
 
14
// You should have received a copy of the GNU General Public      
 
15
// License along with this program; if not, write to the Free     
 
16
// Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 
17
// MA  02111-1307  USA                                            
 
18
 
 
19
#include "Puma/CRecord.h"
 
20
#include "Puma/CClassInfo.h"
 
21
#include "Puma/CUnionInfo.h"
 
22
#include "Puma/CFunctionInfo.h"
 
23
#include "Puma/CTemplateInfo.h"
 
24
#include "Puma/CTree.h"
 
25
#include "Puma/CClassDatabase.h"
 
26
#include <string.h>
 
27
 
 
28
namespace Puma {
 
29
 
 
30
 
 
31
CRecord::~CRecord () {
 
32
////  for (unsigned i = 0; i < Users (); i++) 
 
33
////    User (i)->removeType (this);
 
34
//  CScopeInfo *parent = Parent ();
 
35
//  if (parent && parent->Structure ())
 
36
//    parent->Structure ()->removeType (this);
 
37
//  if (AssignedScope ())
 
38
//    AssignedScope ()->removeType (this);
 
39
//  if (_TemplateInfo)
 
40
//    _TemplateInfo->ObjectInfo ((CObjectInfo*)0);
 
41
}
 
42
 
 
43
//CObjectInfo *CRecord::Referer (const char *name) const { 
 
44
//  for (unsigned i = 0; i < Referers (); i++) 
 
45
//    if (! strcmp (Referer (i)->Name (), name)) 
 
46
//      return Referer (i);
 
47
//  return (CObjectInfo*)0;
 
48
//}
 
49
//
 
50
//CObjectInfo *CRecord::Usage (const char *name) const { 
 
51
//  for (unsigned i = 0; i < Usages (); i++) 
 
52
//    if (! strcmp (Usage (i)->Name (), name)) 
 
53
//      return Usage (i);
 
54
//  return (CObjectInfo*)0;
 
55
//}
 
56
//
 
57
//CFunctionInfo *CRecord::Transferer (const char *name) const { 
 
58
//  for (unsigned i = 0; i < Transferers (); i++) 
 
59
//    if (! strcmp (Transferer (i)->Name (), name)) 
 
60
//      return Transferer (i);
 
61
//  return (CFunctionInfo*)0;
 
62
//}
 
63
//
 
64
//CObjectInfo *CRecord::Transfer (const char *name) const { 
 
65
//  for (unsigned i = 0; i < Transfers (); i++) 
 
66
//    if (! strcmp (Transfer (i)->Name (), name)) 
 
67
//      return Transfer (i);
 
68
//  return (CObjectInfo*)0;
 
69
//}
 
70
//
 
71
//void CRecord::addReferer (CObjectInfo *info) { 
 
72
//  for (unsigned i = 0; i < Referers (); i++) 
 
73
//    if (Referer (i) == info) 
 
74
//      return;
 
75
//  _Referer.append (info); 
 
76
//}
 
77
//
 
78
//void CRecord::addUsage (CObjectInfo *info) { 
 
79
//  for (unsigned i = 0; i < Usages (); i++) 
 
80
//    if (Usage (i) == info) 
 
81
//      return;
 
82
//  _Used.append (info); 
 
83
//}
 
84
//
 
85
//void CRecord::addTransferer (CFunctionInfo *info) { 
 
86
//  for (unsigned i = 0; i < Transferers (); i++) 
 
87
//    if (Transferer (i) == info) 
 
88
//      return;
 
89
//  _Transferer.append (info); 
 
90
//}
 
91
//
 
92
//void CRecord::addTransfer (CObjectInfo *info) { 
 
93
//  for (unsigned i = 0; i < Transfers (); i++) 
 
94
//    if (Transfer (i) == info) 
 
95
//      return;
 
96
//  _Transfered.append (info); 
 
97
//}
 
98
//
 
99
//void CRecord::removeReferer (const CObjectInfo *info) { 
 
100
//  for (unsigned i = 0; i < Referers (); i++) 
 
101
//    if (Referer (i) == info) {
 
102
//      _Referer.remove (i); 
 
103
//      break;
 
104
//    }
 
105
//}
 
106
//
 
107
//void CRecord::removeUsage (const CObjectInfo *info) { 
 
108
//  for (unsigned i = 0; i < Usages (); i++) 
 
109
//    if (Usage (i) == info) {
 
110
//      _Used.remove (i); 
 
111
//      break;
 
112
//    }
 
113
//}
 
114
//
 
115
//void CRecord::removeTransferer (const CFunctionInfo *info) { 
 
116
//  for (unsigned i = 0; i < Transferers (); i++) 
 
117
//    if (Transferer (i) == info) {
 
118
//      _Transferer.remove (i); 
 
119
//      break;
 
120
//    }
 
121
//}
 
122
//
 
123
//void CRecord::removeTransfer (const CObjectInfo *info) { 
 
124
//  for (unsigned i = 0; i < Transfers (); i++) 
 
125
//    if (Transfer (i) == info) {
 
126
//      _Transfered.remove (i); 
 
127
//      break;
 
128
//    }
 
129
//}
 
130
//
 
131
//bool CRecord::isReferer (const CObjectInfo *info) const { 
 
132
//  for (unsigned i = 0; i < Referers (); i++) 
 
133
//    if (Referer (i) == info)
 
134
//      return true;
 
135
//  return false;
 
136
//}
 
137
//
 
138
//bool CRecord::isUsed (const CObjectInfo *info) const { 
 
139
//  for (unsigned i = 0; i < Usages (); i++) 
 
140
//    if (Usage (i) == info)
 
141
//      return true;
 
142
//  return false;
 
143
//}
 
144
//
 
145
//bool CRecord::isTransferer (const CFunctionInfo *info) const { 
 
146
//  for (unsigned i = 0; i < Transferers (); i++) 
 
147
//    if (Transferer (i) == info)
 
148
//      return true;
 
149
//  return false;
 
150
//}
 
151
//
 
152
//bool CRecord::isTransfered (const CObjectInfo *info) const { 
 
153
//  for (unsigned i = 0; i < Transfers (); i++) 
 
154
//    if (Transfer (i) == info)
 
155
//      return true;
 
156
//  return false;
 
157
//}
 
158
 
 
159
bool CRecord::isComplete (unsigned long pos) const {
 
160
  CRecord *info = (CRecord*)DefObject ();
 
161
  if (info->isDefined ()) { 
 
162
    if (pos == 0)
 
163
      return true;
 
164
    CT_Token *token = info->Tree ()->token_node ();
 
165
    if (token && token->Number () <= pos)
 
166
      return true;
 
167
  }
 
168
  return false;
 
169
}
 
170
 
 
171
bool CRecord::isDefined () const { 
 
172
  return Tree () && (Tree ()->NodeName () == CT_ClassDef::NodeId () ||
 
173
                     Tree ()->NodeName () == CT_UnionDef::NodeId ()); 
 
174
}
 
175
 
 
176
 
 
177
} // namespace Puma