use crate::error::GraphvizError;
pub trait AttributeContainer {
fn set_attribute(&self, name: &str, value: &str) -> Result<(), GraphvizError>;
fn get_attribute(&self, name: &str) -> Result<Option<String>, GraphvizError>;
fn has_attribute(&self, name: &str) -> Result<bool, GraphvizError> {
Ok(self.get_attribute(name)?.is_some())
}
fn set_attribute_if_absent(&self, name: &str, value: &str) -> Result<(), GraphvizError> {
if !self.has_attribute(name)? {
self.set_attribute(name, value)?;
}
Ok(())
}
fn remove_attribute(&self, name: &str) -> Result<(), GraphvizError> {
if self.has_attribute(name)? {
self.set_attribute(name, "")?;
}
Ok(())
}
}
pub mod graph {
pub const RANKDIR: &str = "rankdir";
pub const SIZE: &str = "size";
pub const RATIO: &str = "ratio";
pub const FONTNAME: &str = "fontname";
pub const FONTSIZE: &str = "fontsize";
pub const FONTCOLOR: &str = "fontcolor";
pub const LABEL: &str = "label";
pub const BGCOLOR: &str = "bgcolor";
pub const PAGE: &str = "page";
pub const MARGIN: &str = "margin";
pub const STYLE: &str = "style";
pub const CONCENTRATE: &str = "concentrate";
pub const URL: &str = "URL";
pub const ORDERING: &str = "ordering";
pub const RANKSEP: &str = "ranksep";
pub const NODESEP: &str = "nodesep";
pub const EDGE_COLOR: &str = "edge[color]";
pub const EDGE_STYLE: &str = "edge[style]";
pub const EDGE_DIR: &str = "edge[dir]";
pub const NODE_COLOR: &str = "node[color]";
pub const NODE_STYLE: &str = "node[style]";
pub const NODE_SHAPE: &str = "node[shape]";
pub const ROTATE: &str = "rotate";
pub const SPLINES: &str = "splines";
pub const OVERLAP: &str = "overlap";
}
pub mod node {
pub const SHAPE: &str = "shape";
pub const LABEL: &str = "label";
pub const COLOR: &str = "color";
pub const FILLCOLOR: &str = "fillcolor";
pub const STYLE: &str = "style";
pub const FONTNAME: &str = "fontname";
pub const FONTSIZE: &str = "fontsize";
pub const FONTCOLOR: &str = "fontcolor";
pub const WIDTH: &str = "width";
pub const HEIGHT: &str = "height";
pub const FIXEDSIZE: &str = "fixedsize";
pub const URL: &str = "URL";
pub const TOOLTIP: &str = "tooltip";
pub const POS: &str = "pos";
pub const GROUP: &str = "group";
pub const IMAGE: &str = "image";
pub const DISTORTION: &str = "distortion";
pub const SKEW: &str = "skew";
pub const PENWIDTH: &str = "penwidth";
pub const SIDES: &str = "sides";
pub const ORIENTATION: &str = "orientation";
pub const PERIPHERIES: &str = "peripheries";
}
pub mod edge {
pub const LABEL: &str = "label";
pub const COLOR: &str = "color";
pub const STYLE: &str = "style";
pub const DIR: &str = "dir";
pub const FONTNAME: &str = "fontname";
pub const FONTSIZE: &str = "fontsize";
pub const FONTCOLOR: &str = "fontcolor";
pub const WEIGHT: &str = "weight";
pub const MINLEN: &str = "minlen";
pub const URL: &str = "URL";
pub const TOOLTIP: &str = "tooltip";
pub const CONSTRAINT: &str = "constraint";
pub const PENWIDTH: &str = "penwidth";
pub const LABELANGLE: &str = "labelangle";
pub const LABELDISTANCE: &str = "labeldistance";
pub const LABELTOOLTIP: &str = "labeltooltip";
pub const DECORATE: &str = "decorate";
pub const TAILPORT: &str = "tailport";
pub const HEADPORT: &str = "headport";
pub const ARROWHEAD: &str = "arrowhead";
pub const ARROWTAIL: &str = "arrowtail";
pub const POS: &str = "pos";
pub const LPOS: &str = "lp";
}
pub mod values {
pub mod shape {
pub const BOX: &str = "box";
pub const CIRCLE: &str = "circle";
pub const ELLIPSE: &str = "ellipse";
pub const POINT: &str = "point";
pub const DIAMOND: &str = "diamond";
pub const POLYGON: &str = "polygon";
pub const RECORD: &str = "record";
pub const TABLE: &str = "table";
pub const PLAINTEXT: &str = "plaintext";
pub const HOUSE: &str = "house";
pub const INVHOUSE: &str = "invhouse";
pub const TRIANGLE: &str = "triangle";
pub const INVTRIANGLE: &str = "invtriangle";
pub const HEXAGON: &str = "hexagon";
pub const OCTAGON: &str = "octagon";
pub const DOUBLECIRCLE: &str = "doublecircle";
pub const DOUBLEOCTAGON: &str = "doubleoctagon";
pub const TRIPLEOCTAGON: &str = "tripleoctagon";
pub const TRAPEZIUM: &str = "trapezium";
pub const INVTRAPEZIUM: &str = "invtrapezium";
pub const PARALLELOGRAM: &str = "parallelogram";
pub const FOLDER: &str = "folder";
pub const BOX3D: &str = "box3d";
pub const COMPONENT: &str = "component";
pub const CYLINDER: &str = "cylinder";
pub const NOTE: &str = "note";
pub const TAB: &str = "tab";
pub const MDL: &str = "Mdl";
pub const DATABASE: &str = "database";
pub const SIGNATURE: &str = "signature";
}
pub mod style {
pub const SOLID: &str = "solid";
pub const DASHED: &str = "dashed";
pub const DOTTED: &str = "dotted";
pub const BOLD: &str = "bold";
pub const FILLED: &str = "filled";
pub const ROUNDED: &str = "rounded";
pub const DIAGONALS: &str = "diagonals";
pub const INVIS: &str = "invis";
pub const TAPERED: &str = "tapered";
}
pub mod dir {
pub const FORWARD: &str = "forward";
pub const BACK: &str = "back";
pub const BOTH: &str = "both";
pub const NONE: &str = "none";
}
pub mod rankdir {
pub const TB: &str = "TB";
pub const LR: &str = "LR";
pub const BT: &str = "BT";
pub const RL: &str = "RL";
}
pub mod arrowhead {
pub const NORMAL: &str = "normal";
pub const BOX: &str = "box";
pub const CROW: &str = "crow";
pub const DIAMOND: &str = "diamond";
pub const DOT: &str = "dot";
pub const INV: &str = "inv";
pub const NONE: &str = "none";
pub const TEE: &str = "tee";
pub const VEE: &str = "vee";
}
pub mod splines {
pub const TRUE: &str = "true";
pub const FALSE: &str = "false";
pub const NONE: &str = "none";
pub const LINE: &str = "line";
pub const POLYLINE: &str = "polyline";
pub const CURVED: &str = "curved";
pub const ORTHO: &str = "ortho";
pub const SPLINE: &str = "spline";
}
pub mod overlap {
pub const TRUE: &str = "true";
pub const FALSE: &str = "false";
pub const SCALE: &str = "scale";
pub const SCALEXY: &str = "scalexy";
pub const PRISM: &str = "prism";
pub const COMPRESS: &str = "compress";
pub const VPRISM: &str = "vpsc";
pub const FDP: &str = "fdp";
}
}