nitc :: MVisibility
Valid visibility are:
intrude_visibility
public_visibility
protected_visibility
none_visibility
private_visiblity
Note this class is basically an enum.
FIXME: use a real enum once user-defined enums are available
nitc :: MVisibility :: _level
nitc :: MVisibility :: _to_s
nitc :: MVisibility :: cs_visibility_color
Colorizestring
depending on the visibility
nitc :: MVisibility :: defaultinit
nitc :: MVisibility :: level
nitc :: MVisibility :: level=
nitc :: MVisibility :: to_s=
nitc $ MVisibility :: SELF
Type of this instance, automatically specialized in every classnitc :: MVisibility :: _level
nitc :: MVisibility :: _to_s
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
nitc :: MVisibility :: cs_visibility_color
Colorizestring
depending on the visibility
nitc :: MVisibility :: defaultinit
core :: Object :: defaultinit
core :: Comparable :: defaultinit
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
nitc :: MVisibility :: level
nitc :: MVisibility :: level=
core :: Object :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).nitc :: MVisibility :: to_s=
# A visibility (for modules, class and properties)
# Valid visibility are:
#
# * `intrude_visibility`
# * `public_visibility`
# * `protected_visibility`
# * `none_visibility`
# * `private_visiblity`
#
# Note this class is basically an enum.
# FIXME: use a real enum once user-defined enums are available
class MVisibility
super Comparable
redef type OTHER: MVisibility
redef var to_s: String
private var level: Int
# TODO: private init because enumeration.
# Is self give less visibility than other
# none < private < protected < public < intrude
redef fun <(other)
do
return self.level < other.level
end
end
src/model/model_base.nit:120,1--147,3
redef class MVisibility
# Visibility icon
fun cs_icon(no_color: nullable Bool): String do
var icon
if self == private_visibility then
icon = cs_visibility_color("-", no_color)
else if self == protected_visibility then
icon = cs_visibility_color("#", no_color)
else
icon = cs_visibility_color("+", no_color)
end
if no_color != null and no_color then return icon
return icon.bold
end
# Colorize `string` depending on the visibility
fun cs_visibility_color(string: String, no_color: nullable Bool): String do
if no_color != null and no_color then return string
if self == private_visibility then
return string.red
else if self == protected_visibility then
return string.yellow
else
return string.green
end
end
end
src/doc/templates/term_model.nit:282,1--308,3
redef class MVisibility
fun create_ast_representation(astbuilder: nullable ASTBuilder): AVisibility do
if self.to_s == "public" then
return new APublicVisibility
else if self.to_s == "private" then
return new APrivateVisibility
else if self.to_s == "protected" then
return new AProtectedVisibility
else
return new AIntrudeVisibility
end
end
end
src/astbuilder.nit:993,1--1005,3
redef class MVisibility
# Returns the visibility as a UML token
#
# assert public_visibility.tpl_class == "+"
# assert private_visibility.tpl_class == "-"
fun tpl_class: Writable do
if self == private_visibility then
return "-"
else if self == protected_visibility then
return "#"
else if self == public_visibility then
return "+"
else
return "+"
end
end
end
src/uml/uml_class.nit:156,1--172,3