-
Notifications
You must be signed in to change notification settings - Fork 23
/
STClassDesc.h
80 lines (65 loc) · 1.87 KB
/
STClassDesc.h
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
/******************************************************************************
File: STClassDesc.h
Description:
VM representation of Smalltalk ClassDescription class and subclasses.
This level of specialization is not used by the VM, which works at the
Behavior level only
******************************************************************************/
#pragma once
#include "STBehavior.h"
// Declare forward references
namespace ST
{
class Class;
class MetaClass;
class ClassDescription;
}
typedef TOTE<ST::Class> ClassOTE;
typedef TOTE<ST::MetaClass> MetaClassOTE;
typedef TOTE<ST::ClassDescription> ClassDescriptionOTE;
namespace ST
{
class ClassDescription : public Behavior
{
public:
ArrayOTE* m_instanceVariables;
POTE m_methodsCatalogue;
POTE m_protocols;
enum { InstanceVariablesIndex = Behavior::FixedSize, MethodsCatalogueIndex, ProtocolsIndex, FixedSize };
};
class Class : public ClassDescription
{
public:
// TODO: Use Utf8String
AnsiStringOTE* m_name;
POTE m_classPool; /* dictionary of varName, storage */
POTE m_sharedPools;
POTE m_comment;
POTE m_classCategories;
POTE m_guid;
enum {
NameIndex = ClassDescription::FixedSize, ClassPoolIndex,
SharedPoolsIndex, CommentIndex, ClassCategoriesIndex, GUIDIndex, FixedSize
};
#if defined(_DEBUG)
__declspec(property(get = getName)) LPCSTR Name;
LPCSTR getName() const
{
return m_name->m_location->m_characters;
}
#endif
};
class MetaClass : public ClassDescription
{
public:
ClassOTE* m_instanceClass;
enum { InstanceClassIndex = ClassDescription::FixedSize, FixedSize };
};
class StringClass : Class
{
public:
__declspec(property(get = getEncoding)) StringEncoding Encoding;
StringEncoding getEncoding() const { return static_cast<StringEncoding>(m_instanceSpec.m_extraSpec); }
};
}
std::wostream& operator<<(std::wostream& stream, const ST::Class& cl);