5 // Jackson Harper (Jackson@LatitudeGeo.com)
7 // (C) 2003 Jackson Harper, All right reserved
12 using System
.Collections
;
14 namespace Mono
.ILASM
{
16 public class EventDef
{
18 private FeatureAttr attr
;
20 private ITypeRef type
;
21 private PEAPI
.Event event_def
;
22 private bool is_resolved
;
24 private MethodRef addon
;
25 private MethodRef fire
;
26 private MethodRef other
;
27 private MethodRef removeon
;
29 public EventDef (FeatureAttr attr
, ITypeRef type
, string name
)
37 public PEAPI
.Event
Resolve (CodeGen code_gen
, PEAPI
.ClassDef classdef
)
42 type
.Resolve (code_gen
);
43 event_def
= classdef
.AddEvent (name
, type
.PeapiType
);
45 if ((attr
& FeatureAttr
.Rtspecialname
) != 0)
46 event_def
.SetRTSpecialName ();
48 if ((attr
& FeatureAttr
.Specialname
) != 0)
49 event_def
.SetSpecialName ();
56 public void Define (CodeGen code_gen
, PEAPI
.ClassDef classdef
)
59 Resolve (code_gen
, classdef
);
62 addon
.Resolve (code_gen
);
63 event_def
.AddAddon ((PEAPI
.MethodDef
) addon
.PeapiMethod
);
67 fire
.Resolve (code_gen
);
68 event_def
.AddFire ((PEAPI
.MethodDef
) fire
.PeapiMethod
);
72 other
.Resolve (code_gen
);
73 event_def
.AddOther ((PEAPI
.MethodDef
) other
.PeapiMethod
);
76 if (removeon
!= null) {
77 removeon
.Resolve (code_gen
);
78 event_def
.AddRemoveOn ((PEAPI
.MethodDef
) removeon
.PeapiMethod
);
82 public void AddAddon (MethodRef method_ref
)
87 public void AddFire (MethodRef method_ref
)
92 public void AddOther (MethodRef method_ref
)
97 public void AddRemoveon (MethodRef method_ref
)
99 removeon
= method_ref
;