forked from zha0/pdfstreamdumper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCNode.cls
More file actions
59 lines (49 loc) · 1.54 KB
/
CNode.cls
File metadata and controls
59 lines (49 loc) · 1.54 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "CNode"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Public label As String
Public id As String
Public connections As New Collection
Public shape As String
Public style As String
Public color As String
Public fontcolor As String
Public Sub ConnectTo(n As CNode)
'If id = "node_3" And n.id = "node_4" Then Stop
connections.Add n.id
End Sub
Friend Function getAttributes() As String
Dim x As String
x = vbTab & id & "[ "
If Len(label) > 0 Then x = x & "label=""" & safe_label() & """ "
If Len(shape) > 0 Then x = x & "shape=""" & shape & """ "
If Len(style) > 0 Then x = x & "style=""" & style & """ "
If Len(color) > 0 Then x = x & "color=""" & color & """ "
If Len(fontcolor) > 0 Then x = x & "fontcolor=""" & fontcolor & """ "
x = x & "];"
getAttributes = x
End Function
Friend Function getConnections() As String
Dim x As String, n
If connections.count = 0 Then Exit Function
For Each n In connections
x = x & vbTab & id & " -> " & n & ";" & vbCrLf
Next
getConnections = Mid(x, 1, Len(x) - 2)
End Function
Private Function safe_label() As String
Dim x As String
x = Replace(label, vbCrLf, "\n")
x = Replace(x, """", "\""")
safe_label = x
End Function