3a5100b035fab9eb549bb0e056e9aa6fd16a945c
[nit.git] / contrib / neo_doxygen / src / doxml / memberdef.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 # `memberdef` element reading.
16 module doxml::memberdef
17
18 import entitydef
19
20 # Processes the content of a `<memberdef>` element.
21 class MemberDefListener
22 super EntityDefListener
23
24 # The current member.
25 var member: Member is writable, noinit
26 private var type_listener: TypeListener is noinit
27
28 init do
29 super
30 type_listener = new TypeListener(reader, self)
31 end
32
33 redef fun entity do return member
34
35 redef fun start_dox_element(local_name: String, atts: Attributes) do
36 if "name" == local_name then
37 text.listen_until(dox_uri, local_name)
38 else if "reimplements" == local_name then
39 member.reimplement(get_required(atts, "refid"))
40 else if "type" == local_name then
41 type_listener.listen_until(dox_uri, local_name)
42 else
43 super
44 end
45 end
46
47 redef fun end_dox_element(local_name: String) do
48 if "memberdef" == local_name then
49 member.put_in_graph
50 else if "name" == local_name then
51 member.name = text.to_s
52 else if "type" == local_name then
53 source_language.apply_member_type(member, type_listener.linked_text)
54 else
55 super
56 end
57 end
58 end