Updated README

This commit is contained in:
Bartek Kryza
2022-05-21 20:48:36 +02:00
parent 28b0dc66b5
commit 13f0f3861c
3 changed files with 61 additions and 21 deletions

View File

@@ -146,30 +146,63 @@ and checkout the SVG diagrams in `docs/diagrams` folder.
Source code:
```cpp
#include <string>
#include <vector>
namespace clanguml {
namespace t00009 {
template <typename T> class A {
public:
T value;
template <typename T, typename P> struct A {
T t;
P p;
};
class B {
public:
A<int> aint;
A<std::string> *astring;
A<std::vector<std::string>> &avector;
struct B {
std::string value;
};
template <typename T> using AString = A<T, std::string>;
template <typename T> using AStringPtr = A<T, std::unique_ptr<std::string>>;
template <typename T>
using PairPairBA = std::pair<std::pair<B, A<long, T>>, long>;
template <class T> using VectorPtr = std::unique_ptr<std::vector<T>>;
template <class T> using APtr = std::unique_ptr<A<double, T>>;
template <class T> using ASharedPtr = std::shared_ptr<A<double, T>>;
template <class T, class U>
using AAPtr = std::unique_ptr<std::pair<A<double, T>, A<long, U>>>;
template <typename... T> using GeneralCallback = std::function<void(T..., int)>;
using VoidCallback = GeneralCallback<>;
using BVector = std::vector<B>;
using BVector2 = BVector;
using AIntString = AString<int>;
using AStringString = AString<std::string>;
using BStringString = AStringString;
class R {
PairPairBA<bool> bapair;
APtr<bool> abool;
AAPtr<bool, float> aboolfloat;
ASharedPtr<float> afloat;
A<bool, std::string> boolstring;
AStringPtr<float> floatstring;
AIntString intstring;
AStringString stringstring;
BStringString bstringstring;
protected:
BVector bs;
public:
BVector2 bs2;
GeneralCallback<AIntString> cb;
VoidCallback vcb;
VectorPtr<B> vps;
};
}
}
```
generates the following diagram (via PlantUML):
![class_diagram_example](docs/test_cases/t00009_class.svg)
![class_diagram_example](docs/test_cases/t00014_class.svg)
> Open the raw image [here](https://raw.githubusercontent.com/bkryza/clang-uml/master/docs/test_cases/t00009_class.svg),
> and checkout the hover tooltips and hyperlinks to classes and methods.

View File

@@ -101,6 +101,17 @@ diagrams:
ClassA:
- up: ClassB
- left: ClassC
# Specify customized relationship hints for types which are
# arguments in template instantiations
relationship_hints:
# All tuple arguments should be treated as aggregation
std::tuple: aggregation
# All some_template arguments should be treated as associations
# except for arguments with indexes 2 and 10
ns1::n2::some_template:
default: association
2: composition
10: aggregation
# Entities from this namespace will be shortened
# (can only contain one element at the moment)
using_namespace:

View File

@@ -1,11 +1,7 @@
//#include <algorithm>
#include <functional>
//#include <ios>
#include <map>
#include <memory>
//#include <numeric>
#include <string>
//#include <type_traits>
#include <variant>
#include <vector>