-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathClassBrowserInfo.cpp
More file actions
83 lines (75 loc) · 2.32 KB
/
ClassBrowserInfo.cpp
File metadata and controls
83 lines (75 loc) · 2.32 KB
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
#include "stdafx.h"
#include "SCIPicEditor.h"
#include "Compile\ScriptOM.h"
#include "ClassBrowser.h"
#include "ClassBrowserInfo.h"
using namespace sci;
SCIClassBrowserNode::~SCIClassBrowserNode()
{
// Don't delete all our children - they are not owned by us.
}
//
// Scan this guy, and all its superclasses, for methods.
// Put the methods in map.
//
int SCIClassBrowserNode::ComputeAllMethods(MethodVector &array) const
{
int iIndexSubclassBegin = 0;
if (_pClass)
{
const MethodVector &methods = _pClass->GetMethods();
for (size_t i = 0; i < methods.size(); i++)
{
MethodDefinition *pMethod = methods[i];
ASSERT(pMethod);
// Is this method already in the map?
if (!matches_name(array.begin(), array.end(), pMethod->GetName()))
{
// Nope. Add it.
array.push_back(pMethod);
}
// else yes. Subclasses win, so don't do anything here
}
iIndexSubclassBegin = (int)array.size();
// Now go to our parent.
if (_pSuperClass)
{
_pSuperClass->ComputeAllMethods(array);
}
}
return iIndexSubclassBegin;
}
int SCIClassBrowserNode::ComputeAllProperties(ClassPropertyVector &array) const
{
int iIndexSubclassBegin = 0;
if (_pClass)
{
// STLCLEANUP
const ClassPropertyVector &props = _pClass->GetProperties();
for (size_t i = 0; i < props.size(); i++)
{
ClassProperty *pProp = props[i];
ASSERT(pProp);
// Is this method already in the map?
if (!matches_name(array.begin(), array.end(), pProp->GetName()))
{
// Nope. Add it.
array.push_back(pProp);
}
// else yes. Subclasses win, so don't do anything here
}
iIndexSubclassBegin = (int)array.size();
// Now go to our parent.
if (_pSuperClass)
{
_pSuperClass->ComputeAllProperties(array);
}
}
return iIndexSubclassBegin;
}
void SCIClassBrowserNode::RemoveSubClass(SCIClassBrowserNode* pSubClass)
{
// We should always find it.
// Also, assume there is only one.
_subClasses.erase(find(_subClasses.begin(), _subClasses.end(), pSubClass));
}