# t00027 - Template decorator pattern
## Config
```yaml
compilation_database_dir: ..
output_directory: puml
diagrams:
  t00027_class:
    type: class
    glob:
      - ../../tests/t00027/t00027.cc
    using_namespace:
      - clanguml::t00027
    include:
      namespaces:
        - clanguml::t00027

```
## Source code
File t00027.cc
```cpp
#include <memory>
#include <tuple>
#include <type_traits>

namespace clanguml {
namespace t00027 {

class Shape {
public:
    virtual void display() = 0;
    virtual ~Shape() = default;
};

template <template <typename> class... T>
class Line : public Shape, public T<Line<>>... {
public:
    void display() override
    {
        std::apply([](auto &&...x) { (x.display(), ...); },
            std::forward_as_tuple(T<Line<>>()...));
    }
};

template <template <typename> class... T>
class Text : public Shape, public T<Text<>>... {
public:
    void display() override
    {
        std::apply([](auto &&...x) { (x.display(), ...); },
            std::forward_as_tuple(T<Text<>>()...));
    }
};

struct ShapeDecorator {
    virtual void display() = 0;
};

template <typename T> class Color : public ShapeDecorator {
public:
    void display() override { }
};

template <typename T> class Weight : public ShapeDecorator {
public:
    void display() override { }
};

struct Window {
    Line<Color, Weight> border;
    Line<Color> divider;
    Text<Color, Weight> title;
    Text<Color> description;
};
}
}

```
## Generated UML diagrams
![t00027_class](./t00027_class.svg "Template decorator pattern")
