From 01ef3dcbcc62dfdf04b1a2c76468b8c4c4488248 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 10 Jun 2023 18:59:36 +0200 Subject: [PATCH] Updated diagram filters docs --- docs/diagram_filters.md | 66 +++++++++++++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 16 deletions(-) diff --git a/docs/diagram_filters.md b/docs/diagram_filters.md index 41ac062a..b42bb74c 100644 --- a/docs/diagram_filters.md +++ b/docs/diagram_filters.md @@ -2,18 +2,18 @@ -* [`namespaces`](#namespaces) -* [`elements`](#elements) +* [`namespaces` _[string or regex]_](#namespaces-_string-or-regex_) +* [`elements` _[string or regex]_](#elements-_string-or-regex_) * [`element_types`](#element_types) -* [`paths`](#paths) -* [`context`](#context) +* [`paths` _[string or glob]_](#paths-_string-or-glob_) +* [`context` _[string or regex]_](#context-_string-or-regex_) * [`relationships`](#relationships) -* [`subclasses`](#subclasses) -* [`parents`](#parents) -* [`specializations`](#specializations) +* [`subclasses` _[string or regex]_](#subclasses-_string-or-regex_) +* [`parents` _[string or regex]_](#parents-_string-or-regex_) +* [`specializations` _[string or regex]_](#specializations-_string-or-regex_) * [`access`](#access) * [`method_types`](#method_types) -* [`dependants` and `dependencies`](#dependants-and-dependencies) +* [`dependants` and `dependencies` _[string or regex]_](#dependants-and-dependencies-_string-or-regex_) @@ -36,13 +36,47 @@ to your diagram configuration: - ns1::ns2::detail ``` +Some filters accept either specified exact values, some support regular +expressions while some except glob patterns. + +For filters which accept regular expressions, the regular expression has to +be provided as a map `re: 'pattern'` due to the fact the pointer (`*`) otherwise +would have to be escaped in situations such as `mycontainer`, so for +instance to specify that the diagram should exclude all classes containing the +word `test` simply add the following filter: + +```yaml +exclude: + elements: + - re: '.*test.*' +``` + +`paths` filter is currently the only filter which accepts `glob` like patterns. + +The following table specifies the values allowed in each filter: + +| Filter name | Possible values | Example values | +|-------------------|----------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------| +| `namespaces` | Qualified name or regex | - `ns1::ns2::ClassA`
- `re: '.\*detail.\*'` | +| `elements` | Qualified name or regex | - `ns1::ns2::ClassA`
- `re: '.\*detail.\*'` | +| `paths` | File or dir path or glob pattern | - `src/dir1`
- `src/dir2/a.cpp`
- `src/dir3/*.cpp` | +| `context` | Qualified name or regex | - `ns1::ns2::ClassA`
- `re: 'ns1::ns2::ClassA.+'` | +| `relationships` | Type of relationship | - `inheritance`
- `composition`
- `aggregation`
- `ownership`
- `association`
- `instantiation`
- `friendship`
- `dependency` | +| `subclasses` | Qualified name or regex | - `ns1::ns2::ClassA`
- `re: 'ns1::ns2::ClassA.+'` | +| `parents` | Qualified name or regex | - `ns1::ns2::ClassA`
- `re: 'ns1::ns2::ClassA.+'` | +| `specializations` | Qualified name or regex | - `ns1::ns2::ClassA`
- `re: 'ns1::ns2::ClassA.+'` | +| `access` | Method or member access scope | - `public`
- `protected`
- `private` | +| `method_types` | Type of class method | - `constructor`
- `destructor`
- `assignment`
- `operator`
- `defaulted`
- `deleted`
- `static` | +| `dependants` | Qualified name or regex | - `ns1::ns2::ClassA`
- `re: 'ns1::ns2::ClassA.+'` | +| `dependencies` | Qualified name or regex | - `ns1::ns2::ClassA`
- `re: 'ns1::ns2::ClassA.+'` | + The following filters are available. -## `namespaces` +## `namespaces` _[string or regex]_ Allows to include or exclude entities from specific namespaces. -## `elements` +## `elements` _[string or regex]_ Allows to directly include or exclude specific entities from the diagrams, for instance to exclude a specific class from an included namespace: @@ -67,7 +101,7 @@ to remove all enums from a diagram add the following: - enum ``` -## `paths` +## `paths` _[string or glob]_ This filter allows to include or exclude from the diagram elements declared in specific files. @@ -87,7 +121,7 @@ diagrams: Currently, this filter does not allow any globbing or wildcards, however paths to directories can be specified. -## `context` +## `context` _[string or regex]_ This filter allows to limit the diagram elements only to classes which are in direct relationship (of any kind) with the specified class: @@ -121,15 +155,15 @@ The following relationships can be used in this filter: * friendship * dependency -## `subclasses` +## `subclasses` _[string or regex]_ This filter allows to include or exclude all subclasses of a given class in the diagram. -## `parents` +## `parents` _[string or regex]_ This filter allows to include or exclude all parents (base classes) of a given class in the diagram. -## `specializations` +## `specializations` _[string or regex]_ This filter allows to include or exclude specializations and instantiations of a specific template from the diagram. @@ -155,7 +189,7 @@ This filter allows to include or exclude various method types from the class dia This filter is independent of the `access` filter, which controls which methods are included based on access scope (e.g. `public`). -## `dependants` and `dependencies` +## `dependants` and `dependencies` _[string or regex]_ These filters allow to specify that only dependants or dependencies of a given 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