1 # This file is part of NIT ( http://www.nitlanguage.org ).
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
15 # Extensions to the Nit model for foreign languages.
19 intrude import model
::model_base
21 # A type described by a text annoted with links.
23 # For use with Nitdoc only.
29 # The parts that contitute the description of the type.
30 var parts
: Sequence[MTypePart] = new Array[MTypePart]
32 redef fun as_nullable
do
36 redef fun need_anchor
do
40 redef fun resolve_for
(mtype
, anchor
, mmodule
, cleanup_virtual
) do
44 redef fun can_resolve_for
(mtype
, anchor
, mmodule
) do
48 redef fun collect_mclassdefs
(mmodule
) do
50 return new HashSet[MClassDef]
52 redef fun collect_mclasses
(mmodule
) do
54 return new HashSet[MClass]
56 redef fun collect_mtypes
(mmodule
) do
58 return new HashSet[MClassType]
61 redef fun to_s
do return parts
.to_s
63 private fun not_available
do
65 sys
.stderr
.write
"A `MRawType` is for documentation-purpose only so the requested operation is not available.\n"
70 # A part of a `RawType`.
76 # The textual content.
79 # If the part links to another entity, the targeted entity.
80 var target
: nullable MEntity
82 redef fun name
do return text
83 redef fun to_s
do return text
85 # Return a version of `self` that links to the specified entity.
86 fun link_to
(target
: nullable MEntity): MTypePart do
87 return new MTypePart(model
, text
, target
)
95 redef type MPROPDEF: MInnerClassDef
101 # An inner class definition.
105 redef type MPROPDEF: MInnerClassDef
106 redef type MPROPERTY: MInnerClass
108 # The actual class definition.
113 # The “package” visiblity.
115 # Any visibility roughly equivalent to the default visibility of Java, that is
116 # private for a collection of modules.
117 fun package_visibility
: MVisibility do return once
new MVisibility("package", 2)
119 # A class kind with no equivalent semantic in Nit.
120 fun raw_kind
(s
: String): MClassKind do return new MClassKind(s
, false)