Note

You are not reading the most recent version of this documentation.

Context

class Cocotec.CocoPlatform.Coco.Context

Contains AST nodes created from Coco files. A context is the main container for AST nodes created from Coco models.

Subclassed by Cocotec.CocoPlatform.Coco.Ide.ProjectContext, Cocotec.CocoPlatform.Coco.StandaloneContext

Public Functions

Cocotec.CocoPlatform.Coco.SourceRange NodePosition (Cocotec.CocoPlatform.Coco.Node node)

Returns the given node’s position in the Coco file.

List<Cocotec.CocoPlatform.Coco.NodeImportedModules (Cocotec.CocoPlatform.Coco.Node module)

For a module, returns the list of non-stdlib modules that this module directly imports. This does not include transitive dependencies.

List<Cocotec.CocoPlatform.Coco.NodeLoadedModules ()

Returns all modules that have been loaded into this context.

Cocotec.CocoPlatform.Coco.StateMachineSummary GenerateComponentSummary (Cocotec.CocoPlatform.Coco.Node node)

Returns a summary of the state machine at the supplied port or component

Cocotec.CocoPlatform.Coco.ArchitectureDiagram GenerateArchitectureDiagram (Cocotec.CocoPlatform.Coco.Node node, string font, bool componentNames, bool componentTypes, bool portNames, bool portTypes, bool hidePorts, int depth)

Generates an SVG diagram of a component, recursively showing subcomponents.

void GenerateArchitectureDiagramAsync (Cocotec.CocoPlatform.Coco.ArchitectureDiagramHandle listener, Cocotec.CocoPlatform.Coco.Node node, string font, bool componentNames, bool componentTypes, bool portNames, bool portTypes, bool hidePorts, int depth)

Generates an SVG diagram of a component, recursively showing subcomponents, without blocking. Both the listener and the canceller must be kept alive until the listener receives a value. Upon cancellation, the listener will still receive a value.

int MaxArchitectureDiagramDepth (Cocotec.CocoPlatform.Coco.Node node)

Calculates how deep a diagram will be if -1 is passed as the depth parameter to generateArchitectureDiagram.

int RecommendedArchitectureDiagramDepth (Cocotec.CocoPlatform.Coco.Node node)

Recommends a depth limit for a component to avoid the diagram being overwhelming. This can be useful to avoid slow render times for very large diagrams. For flat architectures, it errs on the side of caution and recommends showing too little detail instead of too much.

List<string> GraphvizFonts ()

Returns a list of sans-serif fonts for which Graphviz has hard-coded font metrics, with the nicest fonts listed first.

Cocotec.CocoPlatform.Coco.StateDiagram GenerateStateDiagramGraph (Cocotec.CocoPlatform.Coco.Node node, bool collapseEdges, bool hideTransitionLabels)

Generate dot graph(s) of any state machines found under the specified node. Returns an empty string if no state machines are found.

string InjectStylesIntoStateDiagramSvg (string diagramSvg)

Inject Coco CSS styling into the given state machine diagram generated by generate_state_diagram_graph() and rendered by ‘dot’ into an SVG graphics. The CSS styling text will be injected along with an enclosing style element directly after the first svg element opening. Returns a copy of the given SVG with the CSS injected or the empty string if the injecting failed.

bool Generate (Cocotec.CocoPlatform.Coco.CodeGenerationLanguage language, string outputDirectory)

Generates code from all modules that are currently loaded.

Return
true on error. Diagnostics will have been created on failure.