File: graph_options.go

package info (click to toggle)
golang-github-emicklei-dot 1.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 300 kB
  • sloc: makefile: 9
file content (30 lines) | stat: -rw-r--r-- 540 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package dot

type GraphOption interface {
	Apply(*Graph)
}

type ClusterOption struct{}

func (o ClusterOption) Apply(g *Graph) {
	g.beCluster()
}

var (
	Strict     = GraphTypeOption{"strict"} // only for graph and digraph, not for subgraph
	Undirected = GraphTypeOption{"graph"}
	Directed   = GraphTypeOption{"digraph"}
	Sub        = GraphTypeOption{"subgraph"}
)

type GraphTypeOption struct {
	Name string
}

func (o GraphTypeOption) Apply(g *Graph) {
	if o.Name == Strict.Name {
		g.isStrict = true
		return
	}
	g.graphType = o.Name
}