1
// This file is part of PUMA.
2
// Copyright (C) 1999-2003 The PUMA developer team.
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.
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.
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,
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"
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);
40
// _TemplateInfo->ObjectInfo ((CObjectInfo*)0);
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;
50
//CObjectInfo *CRecord::Usage (const char *name) const {
51
// for (unsigned i = 0; i < Usages (); i++)
52
// if (! strcmp (Usage (i)->Name (), name))
54
// return (CObjectInfo*)0;
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;
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;
71
//void CRecord::addReferer (CObjectInfo *info) {
72
// for (unsigned i = 0; i < Referers (); i++)
73
// if (Referer (i) == info)
75
// _Referer.append (info);
78
//void CRecord::addUsage (CObjectInfo *info) {
79
// for (unsigned i = 0; i < Usages (); i++)
80
// if (Usage (i) == info)
82
// _Used.append (info);
85
//void CRecord::addTransferer (CFunctionInfo *info) {
86
// for (unsigned i = 0; i < Transferers (); i++)
87
// if (Transferer (i) == info)
89
// _Transferer.append (info);
92
//void CRecord::addTransfer (CObjectInfo *info) {
93
// for (unsigned i = 0; i < Transfers (); i++)
94
// if (Transfer (i) == info)
96
// _Transfered.append (info);
99
//void CRecord::removeReferer (const CObjectInfo *info) {
100
// for (unsigned i = 0; i < Referers (); i++)
101
// if (Referer (i) == info) {
102
// _Referer.remove (i);
107
//void CRecord::removeUsage (const CObjectInfo *info) {
108
// for (unsigned i = 0; i < Usages (); i++)
109
// if (Usage (i) == info) {
115
//void CRecord::removeTransferer (const CFunctionInfo *info) {
116
// for (unsigned i = 0; i < Transferers (); i++)
117
// if (Transferer (i) == info) {
118
// _Transferer.remove (i);
123
//void CRecord::removeTransfer (const CObjectInfo *info) {
124
// for (unsigned i = 0; i < Transfers (); i++)
125
// if (Transfer (i) == info) {
126
// _Transfered.remove (i);
131
//bool CRecord::isReferer (const CObjectInfo *info) const {
132
// for (unsigned i = 0; i < Referers (); i++)
133
// if (Referer (i) == info)
138
//bool CRecord::isUsed (const CObjectInfo *info) const {
139
// for (unsigned i = 0; i < Usages (); i++)
140
// if (Usage (i) == info)
145
//bool CRecord::isTransferer (const CFunctionInfo *info) const {
146
// for (unsigned i = 0; i < Transferers (); i++)
147
// if (Transferer (i) == info)
152
//bool CRecord::isTransfered (const CObjectInfo *info) const {
153
// for (unsigned i = 0; i < Transfers (); i++)
154
// if (Transfer (i) == info)
159
bool CRecord::isComplete (unsigned long pos) const {
160
CRecord *info = (CRecord*)DefObject ();
161
if (info->isDefined ()) {
164
CT_Token *token = info->Tree ()->token_node ();
165
if (token && token->Number () <= pos)
171
bool CRecord::isDefined () const {
172
return Tree () && (Tree ()->NodeName () == CT_ClassDef::NodeId () ||
173
Tree ()->NodeName () == CT_UnionDef::NodeId ());