module doxml::compounddef
import memberdef
+import doxyname
import more_collections
# Processes the content of a `compounddef` element.
class CompoundDefListener
super EntityDefListener
+ # The defined compound.
var compound: Compound is writable, noinit
+
private var memberdef: MemberDefListener is noinit
+ private var param_listener: TypeParamListener is noinit
# Default attributes for members in the current section.
private var member_defaults: MemberDefaults is noinit
var defaults = new MemberDefaults("public", false, false)
memberdef = new MemberDefListener(reader, self)
+ param_listener = new TypeParamListener(reader, self)
member_defaults = defaults
section_kinds = new DefaultMap[String, MemberDefaults](defaults)
+ # public
section_kinds["public-type"] = defaults
section_kinds["public-func"] = defaults
section_kinds["public-attrib"] = defaults
section_kinds["public-slot"] = defaults
+ # public static
defaults = new MemberDefaults("public", true, false)
section_kinds["public-static-func"] = defaults
section_kinds["public-static-attrib"] = defaults
-
+ # Not scoped => public static
+ section_kinds["signal"] = defaults
+ section_kinds["dcop-func"] = defaults
+ section_kinds["property"] = defaults
+ section_kinds["event"] = defaults
+ section_kinds["define"] = defaults
+ section_kinds["typedef"] = defaults
+ section_kinds["enum"] = defaults
+ section_kinds["func"] = defaults
+ section_kinds["var"] = defaults
+
+ # protected
defaults = new MemberDefaults("protected", false, false)
section_kinds["protected-type"] = defaults
section_kinds["protected-func"] = defaults
section_kinds["protected-attrib"] = defaults
section_kinds["protected-slot"] = defaults
+ # protected static
defaults = new MemberDefaults("protected", true, false)
section_kinds["protected-static-func"] = defaults
section_kinds["protected-static-attrib"] = defaults
+ # package
defaults = new MemberDefaults("package", false, false)
section_kinds["package-type"] = defaults
section_kinds["package-func"] = defaults
section_kinds["package-attrib"] = defaults
+ # package static
defaults = new MemberDefaults("package", true, false)
section_kinds["package-static-func"] = defaults
section_kinds["package-static-attrib"] = defaults
+ # private
defaults = new MemberDefaults("private", false, false)
section_kinds["private-type"] = defaults
section_kinds["private-func"] = defaults
section_kinds["private-attrib"] = defaults
section_kinds["private-slot"] = defaults
+ # private static
defaults = new MemberDefaults("private", true, false)
section_kinds["private-static-func"] = defaults
section_kinds["private-static-attrib"] = defaults
+ # Special sections.
+ # TODO Do something these sections.
defaults = new MemberDefaults("public", true, true)
section_kinds["related"] = defaults
section_kinds["user-defined"] = defaults
+ # TODO Determine what `friend` and `prototype` mean.
end
redef fun entity: Entity do return compound
redef fun start_dox_element(local_name: String, atts: Attributes) do
- if ["compoundname", "innerclass", "innernamespace"].has(local_name) then
+ if "compoundname" == local_name then
text.listen_until(dox_uri, local_name)
- if ["innerclass", "innernamespace"].has(local_name) then
- refid = get_required(atts, "refid")
- end
- else if "basecompoundref" == local_name then
- refid = get_optional(atts, "refid", "")
+ else if ["innerclass", "innernamespace", "basecompoundref"].has(local_name) then
prot = get_optional(atts, "prot", "")
- virt = get_optional(atts, "virt", "")
text.listen_until(dox_uri, local_name)
+ if "basecompoundref" == local_name then
+ refid = get_optional(atts, "refid", "")
+ virt = get_optional(atts, "virt", "")
+ else
+ refid = get_required(atts, "refid")
+ end
else if "memberdef" == local_name then
read_member(atts)
- else if local_name == "sectiondef" then
+ else if "sectiondef" == local_name then
member_defaults = section_kinds[get_required(atts, "kind")]
if member_defaults.is_special then
super # TODO
end
- else
+ else if "param" == local_name then
+ param_listener.listen_until(dox_uri, local_name)
+ else if "templateparamlist" != local_name then
super
end
end
redef fun end_dox_element(local_name: String) do
- if local_name == "compoundname" then
- compound.full_name = text.to_s
- else if local_name == "innerclass" then
- compound.declare_class(refid, text.to_s)
- else if local_name == "innernamespace" then
+ if "compoundname" == local_name then
+ compound.doxyname = text.to_s
+ else if "innerclass" == local_name then
+ compound.doxygen_declare_class(refid, text.to_s, prot)
+ else if "innernamespace" == local_name then
compound.declare_namespace(refid, text.to_s)
else if "memberdef" == local_name then
if not (memberdef.member isa UnknownMember) then
compound.declare_member(memberdef.member)
end
- else if local_name == "basecompoundref" then
+ else if "basecompoundref" == local_name then
compound.declare_super(refid, text.to_s, prot, virt)
+ else if "param" == local_name and compound isa ClassCompound then
+ compound.as(ClassCompound).add_type_parameter(param_listener.parameter)
else
super
end