# t00036 - Class diagram with namespaces generated as packages
## Config
```yaml
compilation_database_dir: ..
output_directory: puml
diagrams:
  t00036_class:
    type: class
    generate_packages: true
    glob:
      - ../../tests/t00036/t00036.cc
    using_namespace:
      - clanguml::t00036
    include:
      namespaces:
        - clanguml::t00036
    exclude:
      subclasses:
        - clanguml::t00036::ns2::ns22::D
```
## Source code
File t00036.cc
```cpp
namespace clanguml {
namespace t00036 {

namespace ns1 {

enum class E { blue, yellow };

namespace ns11 {

template <typename T> struct A {
    T a;
};

namespace ns111 {

struct B {
    A<int> a_int;
};

}
} // namespace ns11
} // namespace ns1

namespace ns2 {
namespace ns22 {

// TODO: Fix for incomplete struct C declaration "struct C;"
struct C { };

struct D { };

}
}

namespace ns3 {
namespace ns33 {
namespace detail {
struct DImpl : public ns2::ns22::D { };
}
} // namespace ns33
} // namespace ns3

} // namespace t00036
} // namespace clanguml

```
## Generated UML diagrams
![t00036_class](./t00036_class.svg "Class diagram with namespaces generated as packages")
## Generated JSON models
```json
{
  "diagram_type": "class",
  "elements": [
    {
      "display_name": "clanguml::t00036::ns1",
      "elements": [
        {
          "constants": [
            "blue",
            "yellow"
          ],
          "display_name": "clanguml::t00036::ns1::E",
          "id": "2144761953049158478",
          "is_nested": false,
          "name": "E",
          "namespace": "clanguml::t00036::ns1",
          "source_location": {
            "file": "../../tests/t00036/t00036.cc",
            "line": 6
          },
          "type": "enum"
        },
        {
          "display_name": "clanguml::t00036::ns1::ns11",
          "elements": [
            {
              "bases": [],
              "display_name": "clanguml::t00036::ns1::ns11::A<T>",
              "id": "571573305652194946",
              "is_abstract": false,
              "is_nested": false,
              "is_struct": true,
              "is_template": true,
              "is_union": false,
              "members": [
                {
                  "access": "public",
                  "is_static": false,
                  "name": "a",
                  "source_location": {
                    "file": "../../tests/t00036/t00036.cc",
                    "line": 11
                  },
                  "type": "T"
                }
              ],
              "methods": [],
              "name": "A",
              "namespace": "clanguml::t00036::ns1::ns11",
              "source_location": {
                "file": "../../tests/t00036/t00036.cc",
                "line": 10
              },
              "template_parameters": [
                {
                  "is_variadic": false,
                  "kind": "template_type",
                  "name": "T",
                  "template_parameters": []
                }
              ],
              "type": "class"
            },
            {
              "display_name": "clanguml::t00036::ns1::ns11::ns111",
              "elements": [
                {
                  "bases": [],
                  "display_name": "clanguml::t00036::ns1::ns11::ns111::B",
                  "id": "1964031933563607376",
                  "is_abstract": false,
                  "is_nested": false,
                  "is_struct": true,
                  "is_template": false,
                  "is_union": false,
                  "members": [
                    {
                      "access": "public",
                      "is_static": false,
                      "name": "a_int",
                      "source_location": {
                        "file": "../../tests/t00036/t00036.cc",
                        "line": 17
                      },
                      "type": "A<int>"
                    }
                  ],
                  "methods": [],
                  "name": "B",
                  "namespace": "clanguml::t00036::ns1::ns11::ns111",
                  "source_location": {
                    "file": "../../tests/t00036/t00036.cc",
                    "line": 16
                  },
                  "template_parameters": [],
                  "type": "class"
                }
              ],
              "name": "ns111",
              "type": "namespace"
            },
            {
              "bases": [],
              "display_name": "clanguml::t00036::ns1::ns11::A<int>",
              "id": "1832710427462319797",
              "is_abstract": false,
              "is_nested": false,
              "is_struct": false,
              "is_template": true,
              "is_union": false,
              "members": [],
              "methods": [],
              "name": "A",
              "namespace": "clanguml::t00036::ns1::ns11",
              "source_location": {
                "file": "../../tests/t00036/t00036.cc",
                "line": 10
              },
              "template_parameters": [
                {
                  "is_variadic": false,
                  "kind": "argument",
                  "template_parameters": [],
                  "type": "int"
                }
              ],
              "type": "class"
            }
          ],
          "name": "ns11",
          "type": "namespace"
        }
      ],
      "name": "ns1",
      "type": "namespace"
    },
    {
      "display_name": "clanguml::t00036::ns2",
      "elements": [
        {
          "display_name": "clanguml::t00036::ns2::ns22",
          "elements": [
            {
              "bases": [],
              "display_name": "clanguml::t00036::ns2::ns22::C",
              "id": "2038956882066165590",
              "is_abstract": false,
              "is_nested": false,
              "is_struct": true,
              "is_template": false,
              "is_union": false,
              "members": [],
              "methods": [],
              "name": "C",
              "namespace": "clanguml::t00036::ns2::ns22",
              "source_location": {
                "file": "../../tests/t00036/t00036.cc",
                "line": 28
              },
              "template_parameters": [],
              "type": "class"
            }
          ],
          "name": "ns22",
          "type": "namespace"
        }
      ],
      "name": "ns2",
      "type": "namespace"
    },
    {
      "display_name": "clanguml::t00036::ns3",
      "elements": [
        {
          "display_name": "clanguml::t00036::ns3::ns33",
          "elements": [
            {
              "display_name": "clanguml::t00036::ns3::ns33::detail",
              "name": "detail",
              "type": "namespace"
            }
          ],
          "name": "ns33",
          "type": "namespace"
        }
      ],
      "name": "ns3",
      "type": "namespace"
    }
  ],
  "metadata": {
    "clang_uml_version": "0.3.5-27-g81c7ce7",
    "llvm_version": "Ubuntu clang version 15.0.6",
    "schema_version": 1
  },
  "name": "t00036_class",
  "relationships": [
    {
      "access": "public",
      "destination": "1832710427462319797",
      "label": "a_int",
      "source": "1964031933563607376",
      "type": "aggregation"
    },
    {
      "access": "public",
      "destination": "571573305652194946",
      "source": "1832710427462319797",
      "type": "instantiation"
    }
  ],
  "using_namespace": "clanguml::t00036"
}
```
