Files
clang-uml/docs/test_cases/t20013.md
2023-05-03 21:53:49 +02:00

6.2 KiB

t20013 - Function and method arguments in sequence diagrams test case

Config

compilation_database_dir: ..
output_directory: puml
diagrams:
  t20013_sequence:
    type: sequence
    glob:
      - ../../tests/t20013/t20013.cc
    include:
      namespaces:
        - clanguml::t20013
    using_namespace:
      - clanguml::t20013
    start_from:
      - function: "clanguml::t20013::tmain(int,char **)"

Source code

File t20013.cc

namespace clanguml {
namespace t20013 {

struct A {
    int a1(int i) { return i; }
    double a2(double d) { return d; }
    const char *a3(const char *s) { return s; }
};

struct B {
    int b(int i) { return a.a1(i); }
    double b(double d) { return a.a2(d); }
    const char *b(const char *s) { return a.a3(s); }

    A a;
};

void tmain(int argc, char **argv)
{
    B b;

    b.b(1);
    b.b(2.0);
    b.b("three");
}
}
}

Generated UML diagrams

t20013_sequence

Generated JSON models

{
  "diagram_type": "sequence",
  "metadata": {
    "clang_uml_version": "0.3.4-21-g665c784",
    "llvm_version": "Ubuntu clang version 15.0.6",
    "schema_version": 1
  },
  "name": "t20013_sequence",
  "participants": [
    {
      "id": "1249768632077843821",
      "name": "clanguml::t20013::tmain(int,char **)",
      "source_location": {
        "file": "../../tests/t20013/t20013.cc",
        "line": 18
      },
      "type": "function"
    },
    {
      "id": "1106407610612951303",
      "name": "clanguml::t20013::B",
      "source_location": {
        "file": "../../tests/t20013/t20013.cc",
        "line": 10
      },
      "type": "class"
    },
    {
      "id": "976623130699225079",
      "name": "clanguml::t20013::A",
      "source_location": {
        "file": "../../tests/t20013/t20013.cc",
        "line": 4
      },
      "type": "class"
    }
  ],
  "sequences": [
    {
      "messages": [
        {
          "from": {
            "activity_id": "1249768632077843821",
            "activity_name": "clanguml::t20013::tmain(int,char **)",
            "participant_id": "1249768632077843821",
            "participant_name": "clanguml::t20013::tmain(int,char **)"
          },
          "name": "b(int)",
          "return_type": "int",
          "scope": "normal",
          "source_location": {
            "file": "../../tests/t20013/t20013.cc",
            "line": 22
          },
          "to": {
            "activity_id": "2144804108273682993",
            "activity_name": "clanguml::t20013::B::b(int)",
            "participant_id": "1106407610612951303"
          },
          "type": "message"
        },
        {
          "from": {
            "activity_id": "2144804108273682993",
            "activity_name": "clanguml::t20013::B::b(int)",
            "participant_id": "1106407610612951303"
          },
          "name": "a1(int)",
          "return_type": "int",
          "scope": "normal",
          "source_location": {
            "file": "../../tests/t20013/t20013.cc",
            "line": 11
          },
          "to": {
            "activity_id": "1034027282942033004",
            "activity_name": "clanguml::t20013::A::a1(int)",
            "participant_id": "976623130699225079"
          },
          "type": "message"
        },
        {
          "from": {
            "activity_id": "1249768632077843821",
            "activity_name": "clanguml::t20013::tmain(int,char **)",
            "participant_id": "1249768632077843821",
            "participant_name": "clanguml::t20013::tmain(int,char **)"
          },
          "name": "b(double)",
          "return_type": "double",
          "scope": "normal",
          "source_location": {
            "file": "../../tests/t20013/t20013.cc",
            "line": 23
          },
          "to": {
            "activity_id": "640747884486165287",
            "activity_name": "clanguml::t20013::B::b(double)",
            "participant_id": "1106407610612951303"
          },
          "type": "message"
        },
        {
          "from": {
            "activity_id": "640747884486165287",
            "activity_name": "clanguml::t20013::B::b(double)",
            "participant_id": "1106407610612951303"
          },
          "name": "a2(double)",
          "return_type": "double",
          "scope": "normal",
          "source_location": {
            "file": "../../tests/t20013/t20013.cc",
            "line": 12
          },
          "to": {
            "activity_id": "394053399890813915",
            "activity_name": "clanguml::t20013::A::a2(double)",
            "participant_id": "976623130699225079"
          },
          "type": "message"
        },
        {
          "from": {
            "activity_id": "1249768632077843821",
            "activity_name": "clanguml::t20013::tmain(int,char **)",
            "participant_id": "1249768632077843821",
            "participant_name": "clanguml::t20013::tmain(int,char **)"
          },
          "name": "b(const char *)",
          "return_type": "const char *",
          "scope": "normal",
          "source_location": {
            "file": "../../tests/t20013/t20013.cc",
            "line": 24
          },
          "to": {
            "activity_id": "1066935874364409142",
            "activity_name": "clanguml::t20013::B::b(const char *)",
            "participant_id": "1106407610612951303"
          },
          "type": "message"
        },
        {
          "from": {
            "activity_id": "1066935874364409142",
            "activity_name": "clanguml::t20013::B::b(const char *)",
            "participant_id": "1106407610612951303"
          },
          "name": "a3(const char *)",
          "return_type": "const char *",
          "scope": "normal",
          "source_location": {
            "file": "../../tests/t20013/t20013.cc",
            "line": 13
          },
          "to": {
            "activity_id": "1841239321495867611",
            "activity_name": "clanguml::t20013::A::a3(const char *)",
            "participant_id": "976623130699225079"
          },
          "type": "message"
        }
      ],
      "start_from": {
        "id": 1249768632077843821,
        "location": "clanguml::t20013::tmain(int,char **)"
      }
    }
  ],
  "using_namespace": "clanguml::t20013"
}