use crate::diagrams::{class, flowchart, sequence, state};
use crate::format::OutputFormat;
use crate::registry::{DiagramDefinition, DiagramDetector, DiagramFamily, DiagramRegistry};
const GRAPH_FAMILY_FORMATS: &[OutputFormat] = &[
OutputFormat::Text,
OutputFormat::Ascii,
OutputFormat::Svg,
OutputFormat::Mmds,
];
const TIMELINE_FAMILY_FORMATS: &[OutputFormat] = &[
OutputFormat::Text,
OutputFormat::Ascii,
OutputFormat::Svg,
OutputFormat::Mmds,
];
pub fn default_registry() -> DiagramRegistry {
let mut registry = DiagramRegistry::new();
registry.register(DiagramDefinition {
id: "flowchart",
family: DiagramFamily::Graph,
detector: flowchart::detect as DiagramDetector,
factory: || Box::new(flowchart::FlowchartInstance::new()),
supported_formats: GRAPH_FAMILY_FORMATS,
});
registry.register(DiagramDefinition {
id: "class",
family: DiagramFamily::Graph,
detector: class::detect as DiagramDetector,
factory: || Box::new(class::ClassInstance::new()),
supported_formats: GRAPH_FAMILY_FORMATS,
});
registry.register(DiagramDefinition {
id: "state",
family: DiagramFamily::Graph,
detector: state::detect as DiagramDetector,
factory: || Box::new(state::StateInstance::new()),
supported_formats: GRAPH_FAMILY_FORMATS,
});
registry.register(DiagramDefinition {
id: "sequence",
family: DiagramFamily::Timeline,
detector: sequence::detect as DiagramDetector,
factory: || Box::new(sequence::SequenceInstance::new()),
supported_formats: TIMELINE_FAMILY_FORMATS,
});
registry
}