File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
src/main/scala/io/github/binaryfoo/firewall/cp Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ package io .github .binaryfoo .firewall .cp
2
+
3
+ import io .github .binaryfoo .firewall .cp .rules ._
4
+
5
+ object RuleDump {
6
+ def toString (rule : FwrValue , buf : StringBuilder = new StringBuilder (), indent : String = " " ): String = {
7
+ rule match {
8
+ case FwrObject (tag, values) =>
9
+ buf.append(indent).append(" (" ).append(tag).append(" :" )
10
+ values match {
11
+ case List (v : FwrLiteral ) => buf.append(" " ).append(v)
12
+ case List (v : FwrAddressRange ) => buf.append(" " ).append(v)
13
+ case List (v : FwrTableRef ) => buf.append(" " ).append(v)
14
+ case _ =>
15
+ for (value <- values) {
16
+ buf.append(" \n " )
17
+ toString(value, buf, indent + " " )
18
+ }
19
+ }
20
+ buf.append(" )" )
21
+ case other =>
22
+ buf.append(indent).append(rule)
23
+ }
24
+ buf.toString()
25
+ }
26
+ }
You can’t perform that action at this time.
0 commit comments