bkryza / clang-uml

Customizable automatic UML diagram generator for C++ based on Clang.
Apache License 2.0
610 stars 44 forks source link

Refactor configuration file diagram filters config #289

Closed bkryza closed 3 months ago

bkryza commented 5 months ago

Currently, the logical structure of the include and exclude filters is fixed, i.e. some of the filters act as or/anyof while others act as and/allof.

The configuration file syntax should allow users to define their own logic, e.g.:

  # Include an item in the diagram if it matches any of the following filters
  include:
    - anyof:
        # Any element in ns1::ns2 and its subnamespaces
        - namespaces:
            - ns1::ns2
        # Specifically include class std::thread
        - elements:
            - std::thread
        # And also any item that matches all constraints below, i.e.:
        - allof:
            # Any element that is in a direct relation to ns1::ns3::ClassA
            - context:
               - ns1::ns3::ClassA
            # but only if it belongs to ns1::ns3
            - namespaces:
               - ns1::ns3

In order to maintain backward compatiblity, this should be enabled (opt-in) in diagram configuration using some new option, e.g.:

  filter_config_version: 2