287 lines
6.4 KiB
Markdown
287 lines
6.4 KiB
Markdown
# t00010 - Basic template instantiation
|
|
## Config
|
|
```yaml
|
|
diagrams:
|
|
t00010_class:
|
|
type: class
|
|
glob:
|
|
- t00010.cc
|
|
using_namespace: clanguml::t00010
|
|
include:
|
|
namespaces:
|
|
- clanguml::t00010
|
|
|
|
```
|
|
## Source code
|
|
File `tests/t00010/t00010.cc`
|
|
```cpp
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace clanguml {
|
|
namespace t00010 {
|
|
|
|
template <typename T, typename P> class A {
|
|
public:
|
|
T first;
|
|
P second;
|
|
};
|
|
|
|
template <typename T> class B {
|
|
public:
|
|
A<T, std::string> astring;
|
|
};
|
|
|
|
class C {
|
|
public:
|
|
B<int> aintstring;
|
|
};
|
|
} // namespace t00010
|
|
} // namespace clanguml
|
|
|
|
```
|
|
## Generated PlantUML diagrams
|
|

|
|
## Generated Mermaid diagrams
|
|

|
|
## Generated JSON models
|
|
```json
|
|
{
|
|
"diagram_type": "class",
|
|
"elements": [
|
|
{
|
|
"bases": [],
|
|
"display_name": "A<T,P>",
|
|
"id": "17777732951236112797",
|
|
"is_abstract": false,
|
|
"is_nested": false,
|
|
"is_struct": false,
|
|
"is_template": true,
|
|
"is_union": false,
|
|
"members": [
|
|
{
|
|
"access": "public",
|
|
"is_static": false,
|
|
"name": "first",
|
|
"source_location": {
|
|
"column": 7,
|
|
"file": "t00010.cc",
|
|
"line": 9,
|
|
"translation_unit": "t00010.cc"
|
|
},
|
|
"type": "T"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"is_static": false,
|
|
"name": "second",
|
|
"source_location": {
|
|
"column": 7,
|
|
"file": "t00010.cc",
|
|
"line": 10,
|
|
"translation_unit": "t00010.cc"
|
|
},
|
|
"type": "P"
|
|
}
|
|
],
|
|
"methods": [],
|
|
"name": "A",
|
|
"namespace": "clanguml::t00010",
|
|
"source_location": {
|
|
"column": 41,
|
|
"file": "t00010.cc",
|
|
"line": 7,
|
|
"translation_unit": "t00010.cc"
|
|
},
|
|
"template_parameters": [
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "template_type",
|
|
"name": "T",
|
|
"template_parameters": []
|
|
},
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "template_type",
|
|
"name": "P",
|
|
"template_parameters": []
|
|
}
|
|
],
|
|
"type": "class"
|
|
},
|
|
{
|
|
"bases": [],
|
|
"display_name": "A<T,std::string>",
|
|
"id": "14892165549935322401",
|
|
"is_abstract": false,
|
|
"is_nested": false,
|
|
"is_struct": false,
|
|
"is_template": true,
|
|
"is_union": false,
|
|
"members": [],
|
|
"methods": [],
|
|
"name": "A",
|
|
"namespace": "clanguml::t00010",
|
|
"source_location": {
|
|
"column": 41,
|
|
"file": "t00010.cc",
|
|
"line": 7,
|
|
"translation_unit": "t00010.cc"
|
|
},
|
|
"template_parameters": [
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "template_type",
|
|
"name": "T",
|
|
"template_parameters": []
|
|
},
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "argument",
|
|
"template_parameters": [],
|
|
"type": "std::string"
|
|
}
|
|
],
|
|
"type": "class"
|
|
},
|
|
{
|
|
"bases": [],
|
|
"display_name": "B<T>",
|
|
"id": "18428891408661668669",
|
|
"is_abstract": false,
|
|
"is_nested": false,
|
|
"is_struct": false,
|
|
"is_template": true,
|
|
"is_union": false,
|
|
"members": [
|
|
{
|
|
"access": "public",
|
|
"is_static": false,
|
|
"name": "astring",
|
|
"source_location": {
|
|
"column": 23,
|
|
"file": "t00010.cc",
|
|
"line": 15,
|
|
"translation_unit": "t00010.cc"
|
|
},
|
|
"type": "A<T,std::string>"
|
|
}
|
|
],
|
|
"methods": [],
|
|
"name": "B",
|
|
"namespace": "clanguml::t00010",
|
|
"source_location": {
|
|
"column": 29,
|
|
"file": "t00010.cc",
|
|
"line": 13,
|
|
"translation_unit": "t00010.cc"
|
|
},
|
|
"template_parameters": [
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "template_type",
|
|
"name": "T",
|
|
"template_parameters": []
|
|
}
|
|
],
|
|
"type": "class"
|
|
},
|
|
{
|
|
"bases": [],
|
|
"display_name": "B<int>",
|
|
"id": "11987015515847592796",
|
|
"is_abstract": false,
|
|
"is_nested": false,
|
|
"is_struct": false,
|
|
"is_template": true,
|
|
"is_union": false,
|
|
"members": [],
|
|
"methods": [],
|
|
"name": "B",
|
|
"namespace": "clanguml::t00010",
|
|
"source_location": {
|
|
"column": 29,
|
|
"file": "t00010.cc",
|
|
"line": 13,
|
|
"translation_unit": "t00010.cc"
|
|
},
|
|
"template_parameters": [
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "argument",
|
|
"template_parameters": [],
|
|
"type": "int"
|
|
}
|
|
],
|
|
"type": "class"
|
|
},
|
|
{
|
|
"bases": [],
|
|
"display_name": "C",
|
|
"id": "15047732631751140570",
|
|
"is_abstract": false,
|
|
"is_nested": false,
|
|
"is_struct": false,
|
|
"is_template": false,
|
|
"is_union": false,
|
|
"members": [
|
|
{
|
|
"access": "public",
|
|
"is_static": false,
|
|
"name": "aintstring",
|
|
"source_location": {
|
|
"column": 12,
|
|
"file": "t00010.cc",
|
|
"line": 20,
|
|
"translation_unit": "t00010.cc"
|
|
},
|
|
"type": "B<int>"
|
|
}
|
|
],
|
|
"methods": [],
|
|
"name": "C",
|
|
"namespace": "clanguml::t00010",
|
|
"source_location": {
|
|
"column": 7,
|
|
"file": "t00010.cc",
|
|
"line": 18,
|
|
"translation_unit": "t00010.cc"
|
|
},
|
|
"template_parameters": [],
|
|
"type": "class"
|
|
}
|
|
],
|
|
"name": "t00010_class",
|
|
"package_type": "namespace",
|
|
"relationships": [
|
|
{
|
|
"access": "public",
|
|
"destination": "17777732951236112797",
|
|
"source": "14892165549935322401",
|
|
"type": "instantiation"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"destination": "14892165549935322401",
|
|
"label": "astring",
|
|
"source": "18428891408661668669",
|
|
"type": "aggregation"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"destination": "18428891408661668669",
|
|
"source": "11987015515847592796",
|
|
"type": "instantiation"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"destination": "11987015515847592796",
|
|
"label": "aintstring",
|
|
"source": "15047732631751140570",
|
|
"type": "aggregation"
|
|
}
|
|
],
|
|
"using_namespace": "clanguml::t00010"
|
|
}
|
|
```
|