Skip to content

Commit 6f95a03

Browse files
committed
Added relationship_hints test case docs (#394)
1 parent 80d996a commit 6f95a03

File tree

3 files changed

+651
-0
lines changed

3 files changed

+651
-0
lines changed

docs/test_cases/t00092.md

Lines changed: 351 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,351 @@
1+
# t00092 - Test case for relationship_hints config option
2+
## Config
3+
```yaml
4+
diagrams:
5+
t00092_class:
6+
type: class
7+
glob:
8+
- t00092.cc
9+
include:
10+
namespaces:
11+
- clanguml::t00092
12+
exclude:
13+
elements:
14+
- r: "clanguml::t00092::OwningPtr.*"
15+
- r: "clanguml::t00092::WeakPtr.*"
16+
- r: "clanguml::t00092::Map.*"
17+
relationship_hints:
18+
clanguml::t00092::OwningPtr: aggregation
19+
clanguml::t00092::WeakPtr: association
20+
clanguml::t00092::Map:
21+
default: association
22+
0: dependency
23+
1: aggregation
24+
using_namespace: clanguml::t00092
25+
```
26+
## Source code
27+
File `tests/t00092/t00092.cc`
28+
```cpp
29+
#include <map>
30+
31+
namespace clanguml::t00092 {
32+
33+
template <typename T> struct OwningPtr {
34+
T *ptr;
35+
};
36+
37+
template <typename T> struct WeakPtr {
38+
T *ptr;
39+
};
40+
41+
struct String {
42+
char *data;
43+
size_t length;
44+
};
45+
46+
template <typename K, typename V> struct Map {
47+
std::map<K, V> map;
48+
};
49+
50+
class A { };
51+
52+
class B { };
53+
54+
class C { };
55+
56+
class R {
57+
public:
58+
OwningPtr<A> a;
59+
WeakPtr<B> b;
60+
Map<String, C> m;
61+
};
62+
} // namespace clanguml::t00092
63+
64+
```
65+
## Generated PlantUML diagrams
66+
![t00092_class](./t00092_class.svg "Test case for relationship_hints config option")
67+
## Generated Mermaid diagrams
68+
![t00092_class](./t00092_class_mermaid.svg "Test case for relationship_hints config option")
69+
## Generated JSON models
70+
```json
71+
{
72+
"diagram_type": "class",
73+
"elements": [
74+
{
75+
"bases": [],
76+
"display_name": "String",
77+
"id": "3653897770067065487",
78+
"is_abstract": false,
79+
"is_nested": false,
80+
"is_struct": true,
81+
"is_template": false,
82+
"is_union": false,
83+
"members": [
84+
{
85+
"access": "public",
86+
"is_static": false,
87+
"name": "data",
88+
"source_location": {
89+
"column": 11,
90+
"file": "t00092.cc",
91+
"line": 14,
92+
"translation_unit": "t00092.cc"
93+
},
94+
"type": "char *"
95+
},
96+
{
97+
"access": "public",
98+
"is_static": false,
99+
"name": "length",
100+
"source_location": {
101+
"column": 12,
102+
"file": "t00092.cc",
103+
"line": 15,
104+
"translation_unit": "t00092.cc"
105+
},
106+
"type": "size_t"
107+
}
108+
],
109+
"methods": [],
110+
"name": "String",
111+
"namespace": "clanguml::t00092",
112+
"source_location": {
113+
"column": 8,
114+
"file": "t00092.cc",
115+
"line": 13,
116+
"translation_unit": "t00092.cc"
117+
},
118+
"template_parameters": [],
119+
"type": "class"
120+
},
121+
{
122+
"bases": [],
123+
"display_name": "A",
124+
"id": "611725202458589658",
125+
"is_abstract": false,
126+
"is_nested": false,
127+
"is_struct": false,
128+
"is_template": false,
129+
"is_union": false,
130+
"members": [],
131+
"methods": [],
132+
"name": "A",
133+
"namespace": "clanguml::t00092",
134+
"source_location": {
135+
"column": 7,
136+
"file": "t00092.cc",
137+
"line": 22,
138+
"translation_unit": "t00092.cc"
139+
},
140+
"template_parameters": [],
141+
"type": "class"
142+
},
143+
{
144+
"bases": [],
145+
"display_name": "B",
146+
"id": "3521217614773889206",
147+
"is_abstract": false,
148+
"is_nested": false,
149+
"is_struct": false,
150+
"is_template": false,
151+
"is_union": false,
152+
"members": [],
153+
"methods": [],
154+
"name": "B",
155+
"namespace": "clanguml::t00092",
156+
"source_location": {
157+
"column": 7,
158+
"file": "t00092.cc",
159+
"line": 24,
160+
"translation_unit": "t00092.cc"
161+
},
162+
"template_parameters": [],
163+
"type": "class"
164+
},
165+
{
166+
"bases": [],
167+
"display_name": "C",
168+
"id": "2783987908064225198",
169+
"is_abstract": false,
170+
"is_nested": false,
171+
"is_struct": false,
172+
"is_template": false,
173+
"is_union": false,
174+
"members": [],
175+
"methods": [],
176+
"name": "C",
177+
"namespace": "clanguml::t00092",
178+
"source_location": {
179+
"column": 7,
180+
"file": "t00092.cc",
181+
"line": 26,
182+
"translation_unit": "t00092.cc"
183+
},
184+
"template_parameters": [],
185+
"type": "class"
186+
},
187+
{
188+
"bases": [],
189+
"display_name": "R",
190+
"id": "3366051692360576668",
191+
"is_abstract": false,
192+
"is_nested": false,
193+
"is_struct": false,
194+
"is_template": false,
195+
"is_union": false,
196+
"members": [
197+
{
198+
"access": "public",
199+
"is_static": false,
200+
"name": "a",
201+
"source_location": {
202+
"column": 18,
203+
"file": "t00092.cc",
204+
"line": 30,
205+
"translation_unit": "t00092.cc"
206+
},
207+
"type": "OwningPtr<A>"
208+
},
209+
{
210+
"access": "public",
211+
"is_static": false,
212+
"name": "b",
213+
"source_location": {
214+
"column": 16,
215+
"file": "t00092.cc",
216+
"line": 31,
217+
"translation_unit": "t00092.cc"
218+
},
219+
"type": "WeakPtr<B>"
220+
},
221+
{
222+
"access": "public",
223+
"is_static": false,
224+
"name": "m",
225+
"source_location": {
226+
"column": 20,
227+
"file": "t00092.cc",
228+
"line": 32,
229+
"translation_unit": "t00092.cc"
230+
},
231+
"type": "Map<String,C>"
232+
}
233+
],
234+
"methods": [],
235+
"name": "R",
236+
"namespace": "clanguml::t00092",
237+
"source_location": {
238+
"column": 7,
239+
"file": "t00092.cc",
240+
"line": 28,
241+
"translation_unit": "t00092.cc"
242+
},
243+
"template_parameters": [],
244+
"type": "class"
245+
}
246+
],
247+
"name": "t00092_class",
248+
"package_type": "namespace",
249+
"relationships": [
250+
{
251+
"access": "public",
252+
"destination": "611725202458589658",
253+
"label": "a",
254+
"source": "3366051692360576668",
255+
"type": "aggregation"
256+
},
257+
{
258+
"access": "public",
259+
"destination": "3521217614773889206",
260+
"label": "b",
261+
"source": "3366051692360576668",
262+
"type": "association"
263+
},
264+
{
265+
"access": "public",
266+
"destination": "3653897770067065487",
267+
"label": "m",
268+
"source": "3366051692360576668",
269+
"type": "dependency"
270+
},
271+
{
272+
"access": "public",
273+
"destination": "2783987908064225198",
274+
"label": "m",
275+
"source": "3366051692360576668",
276+
"type": "aggregation"
277+
}
278+
],
279+
"using_namespace": "clanguml::t00092"
280+
}
281+
```
282+
## Generated GraphML models
283+
```xml
284+
<?xml version="1.0"?>
285+
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
286+
<key attr.name="id" attr.type="string" for="graph" id="gd0" />
287+
<key attr.name="diagram_type" attr.type="string" for="graph" id="gd1" />
288+
<key attr.name="name" attr.type="string" for="graph" id="gd2" />
289+
<key attr.name="using_namespace" attr.type="string" for="graph" id="gd3" />
290+
<key attr.name="id" attr.type="string" for="node" id="nd0" />
291+
<key attr.name="type" attr.type="string" for="node" id="nd1" />
292+
<key attr.name="name" attr.type="string" for="node" id="nd2" />
293+
<key attr.name="stereotype" attr.type="string" for="node" id="nd3" />
294+
<key attr.name="url" attr.type="string" for="node" id="nd4" />
295+
<key attr.name="tooltip" attr.type="string" for="node" id="nd5" />
296+
<key attr.name="is_template" attr.type="boolean" for="node" id="nd6" />
297+
<key attr.name="type" attr.type="string" for="edge" id="ed0" />
298+
<key attr.name="access" attr.type="string" for="edge" id="ed1" />
299+
<key attr.name="label" attr.type="string" for="edge" id="ed2" />
300+
<key attr.name="url" attr.type="string" for="edge" id="ed3" />
301+
<graph id="g0" edgedefault="directed" parse.nodeids="canonical" parse.edgeids="canonical" parse.order="nodesfirst">
302+
<data key="gd3">clanguml::t00092</data>
303+
<node id="n0">
304+
<data key="nd1">class</data>
305+
<data key="nd2"><![CDATA[String]]></data>
306+
<data key="nd6">false</data>
307+
</node>
308+
<node id="n1">
309+
<data key="nd1">class</data>
310+
<data key="nd2"><![CDATA[A]]></data>
311+
<data key="nd6">false</data>
312+
</node>
313+
<node id="n2">
314+
<data key="nd1">class</data>
315+
<data key="nd2"><![CDATA[B]]></data>
316+
<data key="nd6">false</data>
317+
</node>
318+
<node id="n3">
319+
<data key="nd1">class</data>
320+
<data key="nd2"><![CDATA[C]]></data>
321+
<data key="nd6">false</data>
322+
</node>
323+
<node id="n4">
324+
<data key="nd1">class</data>
325+
<data key="nd2"><![CDATA[R]]></data>
326+
<data key="nd6">false</data>
327+
</node>
328+
<edge id="e0" source="n4" target="n1">
329+
<data key="ed0">aggregation</data>
330+
<data key="ed2">a</data>
331+
<data key="ed1">public</data>
332+
</edge>
333+
<edge id="e1" source="n4" target="n2">
334+
<data key="ed0">association</data>
335+
<data key="ed2">b</data>
336+
<data key="ed1">public</data>
337+
</edge>
338+
<edge id="e2" source="n4" target="n0">
339+
<data key="ed0">dependency</data>
340+
<data key="ed2">m</data>
341+
<data key="ed1">public</data>
342+
</edge>
343+
<edge id="e3" source="n4" target="n3">
344+
<data key="ed0">aggregation</data>
345+
<data key="ed2">m</data>
346+
<data key="ed1">public</data>
347+
</edge>
348+
</graph>
349+
</graphml>
350+
351+
```

0 commit comments

Comments
 (0)