An abstract command that returns a dot graph

Introduced properties

private var _allowed_formats: Array[String]

nitc :: CmdGraph :: _allowed_formats

Allowed rendering formats.
private var _dot: nullable Writable

nitc :: CmdGraph :: _dot

Dot to render
private var _format: String

nitc :: CmdGraph :: _format

Rendering format
private var _mainmodule: MModule

nitc :: CmdGraph :: _mainmodule

Mainmodule for linearization
fun allowed_formats: Array[String]

nitc :: CmdGraph :: allowed_formats

Allowed rendering formats.
protected fun allowed_formats=(allowed_formats: Array[String])

nitc :: CmdGraph :: allowed_formats=

Allowed rendering formats.
init defaultinit(model: Model, filter: nullable ModelFilter, mainmodule: MModule, format: nullable String, dot: nullable Writable)

nitc :: CmdGraph :: defaultinit

fun dot: nullable Writable

nitc :: CmdGraph :: dot

Dot to render
fun dot=(dot: nullable Writable)

nitc :: CmdGraph :: dot=

Dot to render
fun format: String

nitc :: CmdGraph :: format

Rendering format
fun format=(format: nullable String)

nitc :: CmdGraph :: format=

Rendering format
fun mainmodule: MModule

nitc :: CmdGraph :: mainmodule

Mainmodule for linearization
protected fun mainmodule=(mainmodule: MModule)

nitc :: CmdGraph :: mainmodule=

Mainmodule for linearization
fun render: nullable Writable

nitc :: CmdGraph :: render

Render dot depending on format

Redefined properties

redef type SELF: CmdGraph

nitc $ CmdGraph :: SELF

Type of this instance, automatically specialized in every class
redef fun execute(no_color: nullable Bool)

nitc :: term $ CmdGraph :: execute

redef fun http_init(req: HttpRequest): CmdMessage

nitc :: commands_http $ CmdGraph :: http_init

Init the command from an HTTPRequest
redef fun init_command: CmdMessage

nitc $ CmdGraph :: init_command

Initialize the command
redef fun parser_init(mentity_name: String, options: CmdOptions): CmdMessage

nitc :: commands_parser $ CmdGraph :: parser_init

Initialize the command from the CommandParser data
redef fun to_html: Writable

nitc :: html_commands $ CmdGraph :: to_html

Render results as a HTML string
redef fun to_json: nullable Serializable

nitc :: json_commands $ CmdGraph :: to_json

Return a JSON Serializable representation of self results
redef fun to_md: Writable

nitc :: md_commands $ CmdGraph :: to_md

Render results as a Markdown string

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
private var _allowed_formats: Array[String]

nitc :: CmdGraph :: _allowed_formats

Allowed rendering formats.
private var _dot: nullable Writable

nitc :: CmdGraph :: _dot

Dot to render
private var _filter: nullable ModelFilter

nitc :: DocCommand :: _filter

ModelFilter to apply if any
private var _format: String

nitc :: CmdGraph :: _format

Rendering format
private var _mainmodule: MModule

nitc :: CmdGraph :: _mainmodule

Mainmodule for linearization
private var _model: Model

nitc :: DocCommand :: _model

Model to retrieve data for
fun allowed_formats: Array[String]

nitc :: CmdGraph :: allowed_formats

Allowed rendering formats.
protected fun allowed_formats=(allowed_formats: Array[String])

nitc :: CmdGraph :: allowed_formats=

Allowed rendering formats.
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
fun cmd_filter: ModelFilter

nitc :: DocCommand :: cmd_filter

Return a new filter for that command execution.
init defaultinit(model: Model, filter: nullable ModelFilter)

nitc :: DocCommand :: defaultinit

init defaultinit(model: Model, filter: nullable ModelFilter, mainmodule: MModule, format: nullable String, dot: nullable Writable)

nitc :: CmdGraph :: defaultinit

fun dot: nullable Writable

nitc :: CmdGraph :: dot

Dot to render
fun dot=(dot: nullable Writable)

nitc :: CmdGraph :: dot=

Dot to render
abstract fun execute(no_color: nullable Bool)

nitc :: DocCommand :: execute

fun filter: nullable ModelFilter

nitc :: DocCommand :: filter

ModelFilter to apply if any
protected fun filter=(filter: nullable ModelFilter)

nitc :: DocCommand :: filter=

ModelFilter to apply if any
fun format: String

nitc :: CmdGraph :: format

Rendering format
fun format=(format: nullable String)

nitc :: CmdGraph :: format=

Rendering format
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun hash: Int

core :: Object :: hash

The hash code of the object.
fun http_init(req: HttpRequest): CmdMessage

nitc :: DocCommand :: http_init

Init the command from an HTTPRequest
init init

core :: Object :: init

fun init_command: CmdMessage

nitc :: DocCommand :: init_command

Initialize the command
fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
fun mainmodule: MModule

nitc :: CmdGraph :: mainmodule

Mainmodule for linearization
protected fun mainmodule=(mainmodule: MModule)

nitc :: CmdGraph :: mainmodule=

Mainmodule for linearization
fun model: Model

nitc :: DocCommand :: model

Model to retrieve data for
protected fun model=(model: Model)

nitc :: DocCommand :: model=

Model to retrieve data for
private intern fun native_class_name: CString

core :: Object :: native_class_name

The class name of the object in CString format.
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun parser_init(arg: String, options: CmdOptions): CmdMessage

nitc :: DocCommand :: parser_init

Initialize the command from the CommandParser data
fun render: nullable Writable

nitc :: CmdGraph :: render

Render dot depending on format
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
fun to_html: Writable

nitc :: DocCommand :: to_html

Render results as a HTML string
abstract fun to_json: nullable Serializable

nitc :: DocCommand :: to_json

Return a JSON Serializable representation of self results
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_md: Writable

nitc :: DocCommand :: to_md

Render results as a Markdown string
fun to_s: String

core :: Object :: to_s

User readable representation of self.
package_diagram nitc::CmdGraph CmdGraph nitc::DocCommand DocCommand nitc::CmdGraph->nitc::DocCommand core::Object Object nitc::DocCommand->core::Object ...core::Object ... ...core::Object->core::Object nitc::CmdUML CmdUML nitc::CmdUML->nitc::CmdGraph nitc::CmdInheritanceGraph CmdInheritanceGraph nitc::CmdInheritanceGraph->nitc::CmdGraph

Ancestors

interface Object

core :: Object

The root of the class hierarchy.

Parents

abstract class DocCommand

nitc :: DocCommand

Documentation command

Children

class CmdInheritanceGraph

nitc :: CmdInheritanceGraph

Render a hierarchy graph for mentity if any.
class CmdUML

nitc :: CmdUML

UML command

Class definitions

nitc $ CmdGraph
# An abstract command that returns a dot graph
abstract class CmdGraph
	super DocCommand

	# Mainmodule for linearization
	var mainmodule: MModule

	# Rendering format
	#
	# Default is `dot`.
	# See `allowed_formats`.
	var format = "dot" is optional, writable

	# Allowed rendering formats.
	#
	# Can be `dot` or `svg`.
	var allowed_formats: Array[String] = ["dot", "svg"]

	# Dot to render
	var dot: nullable Writable = null is optional, writable

	# Render `dot` depending on `format`
	fun render: nullable Writable do
		var dot = self.dot
		if dot == null then return null
		if format == "svg" then
			var proc = new ProcessDuplex("dot", "-Tsvg")
			var svg = proc.write_and_read(dot.write_to_string)
			proc.close
			proc.wait
			return svg
		end
		return dot
	end

	redef fun init_command do
		if not allowed_formats.has(format) then
			return new ErrorBadGraphFormat(format, allowed_formats)
		end
		return super
	end
end
src/doc/commands/commands_graph.nit:25,1--66,3

nitc :: commands_parser $ CmdGraph
redef class CmdGraph
	redef fun parser_init(mentity_name, options) do
		var opt_format = options.opt_string("format")
		if opt_format != null then format = opt_format
		return super
	end
end
src/doc/commands/commands_parser.nit:363,1--369,3

nitc :: commands_http $ CmdGraph
redef class CmdGraph
	redef fun http_init(req) do
		var opt_format = req.string_arg("format")
		if opt_format != null then format = opt_format
		return super
	end
end
src/doc/commands/commands_http.nit:190,1--196,3

nitc :: md_commands $ CmdGraph
redef class CmdGraph
	redef fun to_md do
		var output = render
		if output == null then return ""
		return output.write_to_string
	end
end
src/doc/templates/md_commands.nit:181,1--187,3

nitc :: json_commands $ CmdGraph
redef class CmdGraph
	redef fun to_json do
		var obj = new JsonObject
		var output = render
		if output != null then
			obj["graph"] = output.write_to_string
		end
		return obj
	end
end
src/doc/templates/json_commands.nit:101,1--110,3

nitc :: term $ CmdGraph
redef class CmdGraph
	redef fun execute(no_color) do
		format = "dot"
		var dot = self.render
		if dot == null then return
		var f = new ProcessWriter("dot", "-Txlib")
		f.write dot.write_to_string
		f.close
		f.wait
	end
end
src/doc/term/term.nit:237,1--247,3

nitc :: html_commands $ CmdGraph
redef class CmdGraph
	redef fun to_html do
		var output = render
		if output == null then return ""
		return output.write_to_string
	end
end
src/doc/templates/html_commands.nit:208,1--214,3