462 lines
11 KiB
Markdown
462 lines
11 KiB
Markdown
# t00003 - Class field and methods
|
|
## Config
|
|
```yaml
|
|
compilation_database_dir: ..
|
|
output_directory: puml
|
|
diagrams:
|
|
t00003_class:
|
|
type: class
|
|
glob:
|
|
- ../../tests/t00003/t00003.cc
|
|
using_namespace:
|
|
- clanguml::t00003
|
|
include:
|
|
namespaces:
|
|
- clanguml::t00003
|
|
|
|
```
|
|
## Source code
|
|
File t00003.cc
|
|
```cpp
|
|
#include <functional>
|
|
#include <string>
|
|
|
|
namespace clanguml {
|
|
namespace t00003 {
|
|
|
|
class A {
|
|
public:
|
|
A() = default;
|
|
A(int i)
|
|
: private_member{i}
|
|
{
|
|
}
|
|
A(A &&) = default;
|
|
A(const A &) = default;
|
|
virtual ~A() = default;
|
|
|
|
void basic_method() { }
|
|
static int static_method() { return 0; }
|
|
void const_method() const { }
|
|
auto auto_method() { return 1; }
|
|
|
|
auto double_int(const int i) { return 2 * i; }
|
|
auto sum(const double a, const double b) { return a_ + b_ + c_; }
|
|
|
|
auto default_int(int i = 12) { return i + 10; }
|
|
std::string default_string(int i, std::string s = "abc")
|
|
{
|
|
return s + std::to_string(i);
|
|
}
|
|
|
|
static A create_from_int(int i) { return A(i); }
|
|
|
|
int public_member;
|
|
static int static_int;
|
|
static const int static_const_int = 1;
|
|
static const auto auto_member{10UL};
|
|
|
|
protected:
|
|
void protected_method() { }
|
|
|
|
int protected_member;
|
|
|
|
std::function<bool(const int)> compare = [this](const int v) {
|
|
return private_member > v;
|
|
};
|
|
|
|
private:
|
|
void private_method() { }
|
|
|
|
int private_member;
|
|
int a_, b_, c_;
|
|
};
|
|
|
|
int A::static_int = 1;
|
|
} // namespace t00003
|
|
} // namespace clanguml
|
|
|
|
```
|
|
## Generated UML diagrams
|
|

|
|
## Generated JSON models
|
|
```json
|
|
{
|
|
"diagram_type": "class",
|
|
"elements": [
|
|
{
|
|
"bases": [],
|
|
"display_name": "clanguml::t00003::A",
|
|
"id": "1371951663534295727",
|
|
"is_abstract": false,
|
|
"is_nested": false,
|
|
"is_struct": false,
|
|
"is_template": false,
|
|
"is_union": false,
|
|
"members": [
|
|
{
|
|
"access": "public",
|
|
"is_static": false,
|
|
"name": "public_member",
|
|
"source_location": {
|
|
"file": "../../tests/t00003/t00003.cc",
|
|
"line": 34
|
|
},
|
|
"type": "int"
|
|
},
|
|
{
|
|
"access": "protected",
|
|
"is_static": false,
|
|
"name": "protected_member",
|
|
"source_location": {
|
|
"file": "../../tests/t00003/t00003.cc",
|
|
"line": 42
|
|
},
|
|
"type": "int"
|
|
},
|
|
{
|
|
"access": "protected",
|
|
"is_static": false,
|
|
"name": "compare",
|
|
"source_location": {
|
|
"file": "../../tests/t00003/t00003.cc",
|
|
"line": 44
|
|
},
|
|
"type": "std::function<bool (const int)>"
|
|
},
|
|
{
|
|
"access": "private",
|
|
"is_static": false,
|
|
"name": "private_member",
|
|
"source_location": {
|
|
"file": "../../tests/t00003/t00003.cc",
|
|
"line": 51
|
|
},
|
|
"type": "int"
|
|
},
|
|
{
|
|
"access": "private",
|
|
"is_static": false,
|
|
"name": "a_",
|
|
"source_location": {
|
|
"file": "../../tests/t00003/t00003.cc",
|
|
"line": 52
|
|
},
|
|
"type": "int"
|
|
},
|
|
{
|
|
"access": "private",
|
|
"is_static": false,
|
|
"name": "b_",
|
|
"source_location": {
|
|
"file": "../../tests/t00003/t00003.cc",
|
|
"line": 52
|
|
},
|
|
"type": "int"
|
|
},
|
|
{
|
|
"access": "private",
|
|
"is_static": false,
|
|
"name": "c_",
|
|
"source_location": {
|
|
"file": "../../tests/t00003/t00003.cc",
|
|
"line": 52
|
|
},
|
|
"type": "int"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"is_static": true,
|
|
"name": "static_int",
|
|
"source_location": {
|
|
"file": "../../tests/t00003/t00003.cc",
|
|
"line": 35
|
|
},
|
|
"type": "int"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"is_static": true,
|
|
"name": "static_const_int",
|
|
"source_location": {
|
|
"file": "../../tests/t00003/t00003.cc",
|
|
"line": 36
|
|
},
|
|
"type": "const int"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"is_static": true,
|
|
"name": "auto_member",
|
|
"source_location": {
|
|
"file": "../../tests/t00003/t00003.cc",
|
|
"line": 37
|
|
},
|
|
"type": "const unsigned long"
|
|
}
|
|
],
|
|
"methods": [
|
|
{
|
|
"access": "public",
|
|
"is_const": false,
|
|
"is_defaulted": true,
|
|
"is_implicit": false,
|
|
"is_pure_virtual": false,
|
|
"is_static": false,
|
|
"is_virtual": false,
|
|
"name": "A",
|
|
"parameters": [],
|
|
"type": "void"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"is_const": false,
|
|
"is_defaulted": false,
|
|
"is_implicit": false,
|
|
"is_pure_virtual": false,
|
|
"is_static": false,
|
|
"is_virtual": false,
|
|
"name": "A",
|
|
"parameters": [
|
|
{
|
|
"name": "i",
|
|
"type": "int"
|
|
}
|
|
],
|
|
"type": "void"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"is_const": false,
|
|
"is_defaulted": true,
|
|
"is_implicit": false,
|
|
"is_pure_virtual": false,
|
|
"is_static": false,
|
|
"is_virtual": false,
|
|
"name": "A",
|
|
"parameters": [
|
|
{
|
|
"name": "",
|
|
"type": "clanguml::t00003::A &&"
|
|
}
|
|
],
|
|
"type": "void"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"is_const": false,
|
|
"is_defaulted": true,
|
|
"is_implicit": false,
|
|
"is_pure_virtual": false,
|
|
"is_static": false,
|
|
"is_virtual": false,
|
|
"name": "A",
|
|
"parameters": [
|
|
{
|
|
"name": "",
|
|
"type": "const clanguml::t00003::A &"
|
|
}
|
|
],
|
|
"type": "void"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"is_const": false,
|
|
"is_defaulted": true,
|
|
"is_implicit": false,
|
|
"is_pure_virtual": false,
|
|
"is_static": false,
|
|
"is_virtual": true,
|
|
"name": "~A",
|
|
"parameters": [],
|
|
"type": "void"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"is_const": false,
|
|
"is_defaulted": false,
|
|
"is_implicit": false,
|
|
"is_pure_virtual": false,
|
|
"is_static": false,
|
|
"is_virtual": false,
|
|
"name": "basic_method",
|
|
"parameters": [],
|
|
"type": "void"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"is_const": false,
|
|
"is_defaulted": false,
|
|
"is_implicit": false,
|
|
"is_pure_virtual": false,
|
|
"is_static": true,
|
|
"is_virtual": false,
|
|
"name": "static_method",
|
|
"parameters": [],
|
|
"type": "int"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"is_const": true,
|
|
"is_defaulted": false,
|
|
"is_implicit": false,
|
|
"is_pure_virtual": false,
|
|
"is_static": false,
|
|
"is_virtual": false,
|
|
"name": "const_method",
|
|
"parameters": [],
|
|
"type": "void"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"is_const": false,
|
|
"is_defaulted": false,
|
|
"is_implicit": false,
|
|
"is_pure_virtual": false,
|
|
"is_static": false,
|
|
"is_virtual": false,
|
|
"name": "auto_method",
|
|
"parameters": [],
|
|
"type": "int"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"is_const": false,
|
|
"is_defaulted": false,
|
|
"is_implicit": false,
|
|
"is_pure_virtual": false,
|
|
"is_static": false,
|
|
"is_virtual": false,
|
|
"name": "double_int",
|
|
"parameters": [
|
|
{
|
|
"name": "i",
|
|
"type": "const int"
|
|
}
|
|
],
|
|
"type": "int"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"is_const": false,
|
|
"is_defaulted": false,
|
|
"is_implicit": false,
|
|
"is_pure_virtual": false,
|
|
"is_static": false,
|
|
"is_virtual": false,
|
|
"name": "sum",
|
|
"parameters": [
|
|
{
|
|
"name": "a",
|
|
"type": "const double"
|
|
},
|
|
{
|
|
"name": "b",
|
|
"type": "const double"
|
|
}
|
|
],
|
|
"type": "int"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"is_const": false,
|
|
"is_defaulted": false,
|
|
"is_implicit": false,
|
|
"is_pure_virtual": false,
|
|
"is_static": false,
|
|
"is_virtual": false,
|
|
"name": "default_int",
|
|
"parameters": [
|
|
{
|
|
"default_value": "12",
|
|
"name": "i",
|
|
"type": "int"
|
|
}
|
|
],
|
|
"type": "int"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"is_const": false,
|
|
"is_defaulted": false,
|
|
"is_implicit": false,
|
|
"is_pure_virtual": false,
|
|
"is_static": false,
|
|
"is_virtual": false,
|
|
"name": "default_string",
|
|
"parameters": [
|
|
{
|
|
"name": "i",
|
|
"type": "int"
|
|
},
|
|
{
|
|
"default_value": "\"abc\"",
|
|
"name": "s",
|
|
"type": "std::string"
|
|
}
|
|
],
|
|
"type": "std::string"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"is_const": false,
|
|
"is_defaulted": false,
|
|
"is_implicit": false,
|
|
"is_pure_virtual": false,
|
|
"is_static": true,
|
|
"is_virtual": false,
|
|
"name": "create_from_int",
|
|
"parameters": [
|
|
{
|
|
"name": "i",
|
|
"type": "int"
|
|
}
|
|
],
|
|
"type": "clanguml::t00003::A"
|
|
},
|
|
{
|
|
"access": "protected",
|
|
"is_const": false,
|
|
"is_defaulted": false,
|
|
"is_implicit": false,
|
|
"is_pure_virtual": false,
|
|
"is_static": false,
|
|
"is_virtual": false,
|
|
"name": "protected_method",
|
|
"parameters": [],
|
|
"type": "void"
|
|
},
|
|
{
|
|
"access": "private",
|
|
"is_const": false,
|
|
"is_defaulted": false,
|
|
"is_implicit": false,
|
|
"is_pure_virtual": false,
|
|
"is_static": false,
|
|
"is_virtual": false,
|
|
"name": "private_method",
|
|
"parameters": [],
|
|
"type": "void"
|
|
}
|
|
],
|
|
"name": "A",
|
|
"namespace": "clanguml::t00003",
|
|
"source_location": {
|
|
"file": "../../tests/t00003/t00003.cc",
|
|
"line": 7
|
|
},
|
|
"template_parameters": [],
|
|
"type": "class"
|
|
}
|
|
],
|
|
"metadata": {
|
|
"clang_uml_version": "0.3.4-28-g3eb1c47",
|
|
"llvm_version": "Ubuntu clang version 15.0.6",
|
|
"schema_version": 1
|
|
},
|
|
"name": "t00003_class",
|
|
"relationships": [],
|
|
"using_namespace": "clanguml::t00003"
|
|
}
|
|
```
|