Improved documentation

This commit is contained in:
Bartek Kryza
2023-07-09 12:33:32 +02:00
parent a6b48a99fd
commit fb370adbfd
11 changed files with 198 additions and 72 deletions

View File

@@ -114,8 +114,7 @@ diagrams:
type: class type: class
glob: glob:
- src/*.cc - src/*.cc
using_namespace: using_namespace: myproject
- myproject
include: include:
namespaces: namespaces:
- myproject - myproject

View File

@@ -29,8 +29,7 @@ diagrams:
glob: glob:
- src/*.cc - src/*.cc
# Render all names in the diagram relative to specific namespace # Render all names in the diagram relative to specific namespace
using_namespace: using_namespace: ns1
- ns1
# Include only classes from specific namespace # Include only classes from specific namespace
include: include:
namespaces: namespaces:
@@ -109,7 +108,7 @@ public:
}; };
``` ```
generates the following diagram: results in the following diagram:
![extension](test_cases/t00007_class.svg) ![extension](test_cases/t00007_class.svg)

View File

@@ -87,7 +87,7 @@ class R {
}; };
``` ```
generates the following class diagram: results in the following class diagram:
![note](./test_cases/t00028_class.svg) ![note](./test_cases/t00028_class.svg)
@@ -141,7 +141,7 @@ struct R {
}; };
``` ```
generates the following diagram: results in the following diagram:
![skip](./test_cases/t00029_class.svg) ![skip](./test_cases/t00029_class.svg)
@@ -185,7 +185,7 @@ struct R {
}; };
``` ```
generates the following diagram: results in the following diagram:
![skip](./test_cases/t00030_class.svg) ![skip](./test_cases/t00030_class.svg)
@@ -226,6 +226,6 @@ struct R {
}; };
``` ```
generates the following diagram: results in the following diagram:
![skip](./test_cases/t00031_class.svg) ![skip](./test_cases/t00031_class.svg)

View File

@@ -57,7 +57,7 @@ The syntax is simple and based on glob patterns, which can be added to the confi
The glob patterns only need to match the translation units, which are also in the `compile_commands.json` file, i.e. The glob patterns only need to match the translation units, which are also in the `compile_commands.json` file, i.e.
any files that match the glob patterns but are not in `compile_commands.json` will be ignored. In case the `glob` any files that match the glob patterns but are not in `compile_commands.json` will be ignored. In case the `glob`
pattern set does not much any translation units an error will be printed on the standard output. pattern set does not match any translation units an error will be printed on the standard output.
For small projects, the `glob` property can be omitted, which will result in `clang-uml` parsing all translation units For small projects, the `glob` property can be omitted, which will result in `clang-uml` parsing all translation units
from `compile_commands.json` for the diagram. However for large projects, constraining the number of translation units from `compile_commands.json` for the diagram. However for large projects, constraining the number of translation units
@@ -96,13 +96,14 @@ specific diagram element.
## Resolving include path and compiler flags issues ## Resolving include path and compiler flags issues
Due to the fact, that your project can be compiled with different compilers Due to the fact, that your project can be compiled with different compilers
and toolchains than the Clang version, which `clang-uml` uses on your platform, and toolchains, the system paths and compilation flags detected by the Clang
include paths specified in the generated `compile_commands.json` can be incorrect. version linked to your `clang-uml` installation might differ from the ones
actually used to compile your project.
> This is often an issue on macOS, when `clang-uml` uses Homebrew version of LLVM > This is often an issue on macOS, when `clang-uml` uses Homebrew version of LLVM
> and your project was built using system Apple Clang > and your project was built using system Apple Clang
Typically, this results in ugly error messages on the screen during diagram Typically, this results in error messages on the console during diagram
generation, such as: generation, such as:
``` ```
@@ -154,15 +155,15 @@ already as `argv[0]` in your `compile_commands.json`, you can simply invoke
clang-uml --query-driver . clang-uml --query-driver .
``` ```
however please make sure that the `compile_commands.json` contain a command, however please make sure that the `compile_commands.json` contains a command,
which is safe to execute. which is safe to execute.
### Manually add and remove compile flags from the compilation database ### Manually add and remove compile flags from the compilation database
If the system paths extracted from the compiler are not sufficient to resolve If the system paths extracted from the compiler are not sufficient to resolve
include paths issues, it is possible to manually adjust the compilation include paths issues, it is possible to manually adjust the compilation
flags providing `add_compile_flags` and `remove_compile_flags` in the flags by providing `add_compile_flags` and `remove_compile_flags` in the
configuration file, or providing `--add-compile-flag` and `--remove-compile-flag` configuration file, or providing `--add-compile-flag` and `--remove-compile-flag`
in the `clang-uml` command line. on the `clang-uml` command line.
For instance: For instance:

View File

@@ -194,8 +194,10 @@ are included based on access scope (e.g. `public`).
## callee_types ## callee_types
This filter is specific for `sequence diagrams` and allows to control which types calls should be included/excluded from the diagram. This filter is specific for `sequence diagrams` and allows to control, which
In a sequence diagram, a `callee` is the receiver of a message, and this filter specifies which types of receivers should match. types of callees should be included/excluded from the diagram. In a sequence diagram,
a `callee` is the receiver of a message, and this filter specifies which types
of receivers should match.
The following callee types are supported: The following callee types are supported:
* constructor * constructor
@@ -210,8 +212,9 @@ The following callee types are supported:
## dependants and dependencies ## dependants and dependencies
These filters allow to specify that only dependants or dependencies of a given class should be included in the diagram. These filters allow to specify that only dependants or dependencies of a given
This can be useful for analyzing what classes in your project depend on some other class, which could have impact for class should be included in the diagram. This can be useful for analyzing what
classes in your project depend on some other class, which could have impact for
instance on refactoring. instance on refactoring.
For instance the following code: For instance the following code:
@@ -283,6 +286,6 @@ and the following filter:
- dependency - dependency
``` ```
generates the following diagram: results in the following diagram:
![t00043_class](./test_cases/t00043_class.svg) ![t00043_class](./test_cases/t00043_class.svg)

View File

@@ -54,7 +54,7 @@ diagram_templates:
## Adding templates to the configuration file ## Adding templates to the configuration file
Diagram templates can be added directly to the `.clang-uml` configuration file, Diagram templates can be added directly to the `.clang-uml` configuration file,
under a `diagram_templates:` key. However, for practical reasons its better under a `diagram_templates:` key. However, for practical reasons it is better
to keep diagram template definitions in a separate Yaml file, and reference to keep diagram template definitions in a separate Yaml file, and reference
it in the configuration file using `include!` directive, e.g.: it in the configuration file using `include!` directive, e.g.:

View File

@@ -46,45 +46,45 @@ An example PlantUML diagram is presented below:
```plantuml ```plantuml
@startuml @startuml
class "A" as C_0001371951663534295727 class "A" as C_0001371951663534295727
class C_0001371951663534295727 [[https://github.com/bkryza/clang-uml/blob/a39af67987036732468c95087191562780a518de/tests/t00003/t00003.cc#L7{A}]] { class C_0001371951663534295727 [[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L7{A}]] {
+A() = default : void +A() = default : void [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L9{A}]]]
+A(int i) : void +A(int i) : void [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L10{A}]]]
+A(A &&) = default : void +A(A &&) = default : void [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L21{A}]]]
+A(const A &) = deleted : void +A(const A &) = deleted : void [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L22{A}]]]
+A<T>(T t) : void +A<T>(T t) : void
+~A() = default : void +~A() = default : void [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L23{~A}]]]
.. ..
+operator=(A && other) noexcept : A & +operator=(A && other) noexcept : A & [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L36{operator=}]]]
+operator=(A & other) noexcept : A & +operator=(A & other) noexcept : A & [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L37{operator=}]]]
.. ..
+operator++() : A & +operator++() : A & [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L30{operator++}]]]
.. ..
+auto_method() : int +auto_method() : int [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L28{auto_method}]]]
+basic_method() : void +basic_method() : void [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L25{basic_method}]]]
+const_method() const : void +const_method() const : void [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L27{const_method}]]]
{static} +create_from_int(int i) : A {static} +create_from_int(int i) : A [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L50{create_from_int}]]]
+default_int(int i = 12) : int +default_int(int i = 12) : int [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L44{default_int}]]]
+default_string(int i, std::string s = "abc") : std::string +default_string(int i, std::string s = "abc") : std::string [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L45{default_string}]]]
+double_int(const int i) : int +double_int(const int i) : int [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L41{double_int}]]]
-private_method() : void -private_method() : void [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L67{private_method}]]]
#protected_method() : void #protected_method() : void [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L58{protected_method}]]]
+size() constexpr const : std::size_t +size() constexpr const : std::size_t [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L39{size}]]]
{static} +static_method() : int {static} +static_method() : int [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L26{static_method}]]]
+sum(const double a, const double b) : int +sum(const double a, const double b) : int [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L42{sum}]]]
__ __
-a_ : int [[[https://github.com/bkryza/clang-uml/blob/a39af67987036732468c95087191562780a518de/tests/t00003/t00003.cc#L70{a_}]]] -a_ : int [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L70{a_}]]]
{static} +auto_member : const unsigned long [[[https://github.com/bkryza/clang-uml/blob/a39af67987036732468c95087191562780a518de/tests/t00003/t00003.cc#L55{auto_member}]]] {static} +auto_member : const unsigned long [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L55{auto_member}]]]
-b_ : int [[[https://github.com/bkryza/clang-uml/blob/a39af67987036732468c95087191562780a518de/tests/t00003/t00003.cc#L70{b_}]]] -b_ : int [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L70{b_}]]]
-c_ : int [[[https://github.com/bkryza/clang-uml/blob/a39af67987036732468c95087191562780a518de/tests/t00003/t00003.cc#L70{c_}]]] -c_ : int [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L70{c_}]]]
#compare : std::function<bool (const int)> [[[https://github.com/bkryza/clang-uml/blob/a39af67987036732468c95087191562780a518de/tests/t00003/t00003.cc#L62{compare}]]] #compare : std::function<bool (const int)> [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L62{compare}]]]
-private_member : int [[[https://github.com/bkryza/clang-uml/blob/a39af67987036732468c95087191562780a518de/tests/t00003/t00003.cc#L69{private_member}]]] -private_member : int [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L69{private_member}]]]
#protected_member : int [[[https://github.com/bkryza/clang-uml/blob/a39af67987036732468c95087191562780a518de/tests/t00003/t00003.cc#L60{protected_member}]]] #protected_member : int [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L60{protected_member}]]]
+public_member : int [[[https://github.com/bkryza/clang-uml/blob/a39af67987036732468c95087191562780a518de/tests/t00003/t00003.cc#L52{public_member}]]] +public_member : int [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L52{public_member}]]]
{static} +static_const_int : const int [[[https://github.com/bkryza/clang-uml/blob/a39af67987036732468c95087191562780a518de/tests/t00003/t00003.cc#L54{static_const_int}]]] {static} +static_const_int : const int [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L54{static_const_int}]]]
{static} +static_int : int [[[https://github.com/bkryza/clang-uml/blob/a39af67987036732468c95087191562780a518de/tests/t00003/t00003.cc#L53{static_int}]]] {static} +static_int : int [[[https://github.com/bkryza/clang-uml/blob/59d6fd5c7f14e028d1817274d80da29c338c2b53/tests/t00003/t00003.cc#L53{static_int}]]]
} }
'Generated with clang-uml, version 0.3.7-20-ga39af67 'Generated with clang-uml, version 0.3.8
'LLVM version Ubuntu clang version 15.0.6 'LLVM version Ubuntu clang version 15.0.6
@enduml @enduml
``` ```
@@ -253,6 +253,12 @@ An equivalent of the above PlantUML diagram in JSON is presented below:
"is_virtual": false, "is_virtual": false,
"name": "A", "name": "A",
"parameters": [], "parameters": [],
"source_location": {
"column": 5,
"file": "../../tests/t00003/t00003.cc",
"line": 9,
"translation_unit": "../../tests/t00003/t00003.cc"
},
"type": "void" "type": "void"
}, },
{ {
@@ -277,6 +283,12 @@ An equivalent of the above PlantUML diagram in JSON is presented below:
"type": "int" "type": "int"
} }
], ],
"source_location": {
"column": 5,
"file": "../../tests/t00003/t00003.cc",
"line": 10,
"translation_unit": "../../tests/t00003/t00003.cc"
},
"type": "void" "type": "void"
}, },
{ {
@@ -301,6 +313,12 @@ An equivalent of the above PlantUML diagram in JSON is presented below:
"type": "clanguml::t00003::A &&" "type": "clanguml::t00003::A &&"
} }
], ],
"source_location": {
"column": 5,
"file": "../../tests/t00003/t00003.cc",
"line": 21,
"translation_unit": "../../tests/t00003/t00003.cc"
},
"type": "void" "type": "void"
}, },
{ {
@@ -325,6 +343,12 @@ An equivalent of the above PlantUML diagram in JSON is presented below:
"type": "const clanguml::t00003::A &" "type": "const clanguml::t00003::A &"
} }
], ],
"source_location": {
"column": 5,
"file": "../../tests/t00003/t00003.cc",
"line": 22,
"translation_unit": "../../tests/t00003/t00003.cc"
},
"type": "void" "type": "void"
}, },
{ {
@@ -344,6 +368,12 @@ An equivalent of the above PlantUML diagram in JSON is presented below:
"is_virtual": true, "is_virtual": true,
"name": "~A", "name": "~A",
"parameters": [], "parameters": [],
"source_location": {
"column": 13,
"file": "../../tests/t00003/t00003.cc",
"line": 23,
"translation_unit": "../../tests/t00003/t00003.cc"
},
"type": "void" "type": "void"
}, },
{ {
@@ -363,6 +393,12 @@ An equivalent of the above PlantUML diagram in JSON is presented below:
"is_virtual": false, "is_virtual": false,
"name": "basic_method", "name": "basic_method",
"parameters": [], "parameters": [],
"source_location": {
"column": 10,
"file": "../../tests/t00003/t00003.cc",
"line": 25,
"translation_unit": "../../tests/t00003/t00003.cc"
},
"type": "void" "type": "void"
}, },
{ {
@@ -382,6 +418,12 @@ An equivalent of the above PlantUML diagram in JSON is presented below:
"is_virtual": false, "is_virtual": false,
"name": "static_method", "name": "static_method",
"parameters": [], "parameters": [],
"source_location": {
"column": 16,
"file": "../../tests/t00003/t00003.cc",
"line": 26,
"translation_unit": "../../tests/t00003/t00003.cc"
},
"type": "int" "type": "int"
}, },
{ {
@@ -401,6 +443,12 @@ An equivalent of the above PlantUML diagram in JSON is presented below:
"is_virtual": false, "is_virtual": false,
"name": "const_method", "name": "const_method",
"parameters": [], "parameters": [],
"source_location": {
"column": 10,
"file": "../../tests/t00003/t00003.cc",
"line": 27,
"translation_unit": "../../tests/t00003/t00003.cc"
},
"type": "void" "type": "void"
}, },
{ {
@@ -420,6 +468,12 @@ An equivalent of the above PlantUML diagram in JSON is presented below:
"is_virtual": false, "is_virtual": false,
"name": "auto_method", "name": "auto_method",
"parameters": [], "parameters": [],
"source_location": {
"column": 10,
"file": "../../tests/t00003/t00003.cc",
"line": 28,
"translation_unit": "../../tests/t00003/t00003.cc"
},
"type": "int" "type": "int"
}, },
{ {
@@ -439,6 +493,12 @@ An equivalent of the above PlantUML diagram in JSON is presented below:
"is_virtual": false, "is_virtual": false,
"name": "operator++", "name": "operator++",
"parameters": [], "parameters": [],
"source_location": {
"column": 8,
"file": "../../tests/t00003/t00003.cc",
"line": 30,
"translation_unit": "../../tests/t00003/t00003.cc"
},
"type": "clanguml::t00003::A &" "type": "clanguml::t00003::A &"
}, },
{ {
@@ -463,6 +523,12 @@ An equivalent of the above PlantUML diagram in JSON is presented below:
"type": "clanguml::t00003::A &&" "type": "clanguml::t00003::A &&"
} }
], ],
"source_location": {
"column": 8,
"file": "../../tests/t00003/t00003.cc",
"line": 36,
"translation_unit": "../../tests/t00003/t00003.cc"
},
"type": "clanguml::t00003::A &" "type": "clanguml::t00003::A &"
}, },
{ {
@@ -487,6 +553,12 @@ An equivalent of the above PlantUML diagram in JSON is presented below:
"type": "clanguml::t00003::A &" "type": "clanguml::t00003::A &"
} }
], ],
"source_location": {
"column": 8,
"file": "../../tests/t00003/t00003.cc",
"line": 37,
"translation_unit": "../../tests/t00003/t00003.cc"
},
"type": "clanguml::t00003::A &" "type": "clanguml::t00003::A &"
}, },
{ {
@@ -506,6 +578,12 @@ An equivalent of the above PlantUML diagram in JSON is presented below:
"is_virtual": false, "is_virtual": false,
"name": "size", "name": "size",
"parameters": [], "parameters": [],
"source_location": {
"column": 27,
"file": "../../tests/t00003/t00003.cc",
"line": 39,
"translation_unit": "../../tests/t00003/t00003.cc"
},
"type": "std::size_t" "type": "std::size_t"
}, },
{ {
@@ -530,6 +608,12 @@ An equivalent of the above PlantUML diagram in JSON is presented below:
"type": "const int" "type": "const int"
} }
], ],
"source_location": {
"column": 10,
"file": "../../tests/t00003/t00003.cc",
"line": 41,
"translation_unit": "../../tests/t00003/t00003.cc"
},
"type": "int" "type": "int"
}, },
{ {
@@ -558,6 +642,12 @@ An equivalent of the above PlantUML diagram in JSON is presented below:
"type": "const double" "type": "const double"
} }
], ],
"source_location": {
"column": 10,
"file": "../../tests/t00003/t00003.cc",
"line": 42,
"translation_unit": "../../tests/t00003/t00003.cc"
},
"type": "int" "type": "int"
}, },
{ {
@@ -583,6 +673,12 @@ An equivalent of the above PlantUML diagram in JSON is presented below:
"type": "int" "type": "int"
} }
], ],
"source_location": {
"column": 10,
"file": "../../tests/t00003/t00003.cc",
"line": 44,
"translation_unit": "../../tests/t00003/t00003.cc"
},
"type": "int" "type": "int"
}, },
{ {
@@ -612,6 +708,12 @@ An equivalent of the above PlantUML diagram in JSON is presented below:
"type": "std::string" "type": "std::string"
} }
], ],
"source_location": {
"column": 17,
"file": "../../tests/t00003/t00003.cc",
"line": 45,
"translation_unit": "../../tests/t00003/t00003.cc"
},
"type": "std::string" "type": "std::string"
}, },
{ {
@@ -636,6 +738,12 @@ An equivalent of the above PlantUML diagram in JSON is presented below:
"type": "int" "type": "int"
} }
], ],
"source_location": {
"column": 14,
"file": "../../tests/t00003/t00003.cc",
"line": 50,
"translation_unit": "../../tests/t00003/t00003.cc"
},
"type": "clanguml::t00003::A" "type": "clanguml::t00003::A"
}, },
{ {
@@ -655,6 +763,12 @@ An equivalent of the above PlantUML diagram in JSON is presented below:
"is_virtual": false, "is_virtual": false,
"name": "protected_method", "name": "protected_method",
"parameters": [], "parameters": [],
"source_location": {
"column": 10,
"file": "../../tests/t00003/t00003.cc",
"line": 58,
"translation_unit": "../../tests/t00003/t00003.cc"
},
"type": "void" "type": "void"
}, },
{ {
@@ -674,6 +788,12 @@ An equivalent of the above PlantUML diagram in JSON is presented below:
"is_virtual": false, "is_virtual": false,
"name": "private_method", "name": "private_method",
"parameters": [], "parameters": [],
"source_location": {
"column": 10,
"file": "../../tests/t00003/t00003.cc",
"line": 67,
"translation_unit": "../../tests/t00003/t00003.cc"
},
"type": "void" "type": "void"
}, },
{ {
@@ -714,7 +834,7 @@ An equivalent of the above PlantUML diagram in JSON is presented below:
} }
], ],
"metadata": { "metadata": {
"clang_uml_version": "0.3.7-20-ga39af67", "clang_uml_version": "0.3.8",
"llvm_version": "Ubuntu clang version 15.0.6", "llvm_version": "Ubuntu clang version 15.0.6",
"schema_version": 1 "schema_version": 1
}, },

View File

@@ -6,8 +6,9 @@
<!-- tocstop --> <!-- tocstop -->
Package diagrams are simple diagrams which can be useful to determine the high level structure of a C++ project, Package diagrams are simple diagrams, which can be useful to visualize a high
by rendering all projects namespaces as UML packages and their interdependencies. level structure of a C++ project, by rendering all projects namespaces or
subdirectories as UML packages and their interdependencies.
The minimal config required to generate a package diagram is presented below: The minimal config required to generate a package diagram is presented below:
```yaml ```yaml
@@ -156,7 +157,7 @@ results the following diagram:
![package_deps](./test_cases/t30002_package.svg) ![package_deps](./test_cases/t30002_package.svg)
By default, packages are generated from C++ namespaces in the code. However By default, packages are generated from C++ namespaces in the code. However,
they can also be generated from the subdirectories in the filesystem tree by they can also be generated from the subdirectories in the filesystem tree by
adding the following option to the configuration file: adding the following option to the configuration file:

View File

@@ -26,8 +26,7 @@ To add an initial class diagram to your project, follow these steps:
glob: glob:
- src/*.cc - src/*.cc
# Render all names relative to `myproject` namespace # Render all names relative to `myproject` namespace
using_namespace: using_namespace: myproject
- myproject
include: include:
# Include only elements in `myproject` namespace # Include only elements in `myproject` namespace
namespaces: namespaces:

View File

@@ -105,8 +105,8 @@ following rules:
* If lambda expression is called within the scope of the diagram, the calls from the lambda will be placed * If lambda expression is called within the scope of the diagram, the calls from the lambda will be placed
at the lambda invocation and not declaration at the lambda invocation and not declaration
* If lambda expression is passed to some function or method, which is outside the scope of the diagram * If lambda expression is passed to some function or method, which is outside the scope of the diagram
(e.g. used in `std::transform` call) the call will be generated at the point where lambda is passed as parameter (e.g. used in `std::transform` call) the call will not be generated
* If the lambda is passed as template parameter in instantiation it will not be generated at the moment at all * If the lambda is passed as template parameter in instantiation it will not be generated
Another issue is the naming of lambda participants. Currently, each lambda is rendered in the diagram as a separate Another issue is the naming of lambda participants. Currently, each lambda is rendered in the diagram as a separate
class whose name is composed of the lambda location in the code (the only unique way of identifying lambdas I was able class whose name is composed of the lambda location in the code (the only unique way of identifying lambdas I was able
@@ -211,7 +211,7 @@ void tmain()
} }
``` ```
generates the following diagram: results in the following diagram:
![extension](test_cases/t20012_sequence.svg) ![extension](test_cases/t20012_sequence.svg)
@@ -235,16 +235,15 @@ diagrams:
exclude: exclude:
access: access:
- private - private
using_namespace: using_namespace: clanguml::t20029
- clanguml::t20029
start_from: start_from:
- function: clanguml::t20029::tmain() - function: clanguml::t20029::tmain()
participants_order: participants_order:
- clanguml::t20029::tmain() - "clanguml::t20029::tmain()"
- clanguml::t20029::Encoder<clanguml::t20029::Retrier<clanguml::t20029::ConnectionPool>> - "clanguml::t20029::Encoder<clanguml::t20029::Retrier<clanguml::t20029::ConnectionPool>>"
- clanguml::t20029::Retrier<clanguml::t20029::ConnectionPool> - "clanguml::t20029::Retrier<clanguml::t20029::ConnectionPool>"
- clanguml::t20029::ConnectionPool - "clanguml::t20029::ConnectionPool"
- clanguml::t20029::encode_b64(std::string &&) - "clanguml::t20029::encode_b64(std::string &&)"
``` ```
## Generating return types ## Generating return types
@@ -262,6 +261,9 @@ generate_return_types: true
This option only affects the `plantuml` generation, in `json` generator This option only affects the `plantuml` generation, in `json` generator
`return_type` property is always present in the message nodes. `return_type` property is always present in the message nodes.
The diagram below presents what it looks like in a PlantUML generated diagram:
![extension](test_cases/t20032_sequence.svg)
## Generating condition statements ## Generating condition statements
Sometimes, it is useful to include actual condition statements (for instance Sometimes, it is useful to include actual condition statements (for instance
@@ -274,3 +276,6 @@ This can be enabled using the following option:
generate_condition_statements: true generate_condition_statements: true
``` ```
An example of a diagram with this feature enabled is presented below:
![extension](test_cases/t20033_sequence.svg)

View File

@@ -5,8 +5,7 @@ diagrams:
type: class type: class
glob: glob:
- ../../tests/t00003/t00003.cc - ../../tests/t00003/t00003.cc
using_namespace: using_namespace: clanguml::t00003
- clanguml::t00003
include: include:
namespaces: namespaces:
- clanguml::t00003 - clanguml::t00003