49a6dd6e0708a56f231a9eaa07a4658ed2e7e4d4
[WebKit-https.git] / WebCore / khtml / xbl / xbl_protoimplementation.cpp
1 #include "xbl_protoimplementation.h"
2 #include "xbl_protobinding.h"
3
4 using DOM::DOMString;
5
6 namespace XBL
7 {
8
9 XBLPrototypeImplementation::XBLPrototypeImplementation(const DOM::DOMString& name, XBLPrototypeBinding* binding)
10 :m_name(name), m_binding(binding), m_member(0), m_compiled(false)
11 {
12
13 }
14
15
16 XBLPrototypeMember::XBLPrototypeMember(const DOMString& name)
17 :m_name(name), m_next(0)
18 {
19 }
20
21 void XBLPrototypeMember::appendData(const DOM::DOMString& data)
22 {
23     m_data += data;
24 }
25
26 XBLPrototypeMethod::XBLPrototypeMethod(const DOM::DOMString& name)
27 :XBLPrototypeMember(name)
28 {
29 }
30
31 bool XBLPrototypeMethod::isConstructor() const
32 {
33     return false;
34 }
35
36 bool XBLPrototypeMethod::isDestructor() const
37 {
38     return false;
39 }
40
41 void XBLPrototypeMethod::addParameter(const DOM::DOMString& name)
42 {
43     XBLPrototypeParameter* last = 0;
44     for (XBLPrototypeParameter* curr = m_parameter; curr; curr = curr->next())
45         last = curr;
46     if (last)
47         m_parameter = new XBLPrototypeParameter(name);
48     else
49         last->setNext(new XBLPrototypeParameter(name));
50 }
51
52 XBLPrototypeConstructor::XBLPrototypeConstructor()
53 :XBLPrototypeMethod("_constructor")
54 {}
55
56 bool XBLPrototypeConstructor::isConstructor() const
57 {
58     return true;
59 }
60
61 XBLPrototypeDestructor::XBLPrototypeDestructor()
62 :XBLPrototypeMethod("_destructor")
63 {}
64
65 bool XBLPrototypeDestructor::isDestructor() const
66 {
67     return true;
68 }
69
70 XBLPrototypeField::XBLPrototypeField(const DOM::DOMString& name, bool readonly)
71 :XBLPrototypeMember(name), m_readonly(readonly)
72 {
73 }
74
75 XBLPrototypeProperty::XBLPrototypeProperty(const DOM::DOMString& name, bool readonly, 
76                                            const DOM::DOMString& onget,
77                                            const DOM::DOMString& onset)
78 :XBLPrototypeMember(name), m_setter(onset), m_readonly(readonly)
79 {
80     m_data = onget;
81 }
82
83 void XBLPrototypeProperty::appendGetterText(const DOM::DOMString& text)
84 {
85     return appendData(text);
86 }
87
88 void XBLPrototypeProperty::appendSetterText(const DOM::DOMString& text)
89 {
90     m_setter += text;
91 }
92
93 }