小编Bla*_*ack的帖子

在 doxygen Markdown 页面中使用 UML

我正在将 doxygen 用于我的个人项目,并希望在我自己创建的页面(markdown 页面)上使用任何类型的 UML 语言。我并不是想在代码中使用它(它确实有效),而是在我自己创建的文档上,请参阅下面的示例:

# Example

sequenceDiagram
    participant Alice
    participant Bob
    Alice->>John: Hello John, how are you?
    loop Healthcheck
        John->>John: Fight against hypochondria
    end
    Note right of John: Rational thoughts <br/>prevail!
    John-->>Alice: Great!
    John->>Bob: How about you?
    Bob-->>John: Jolly good!

```plantuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response

Alice -> Bob: Another authentication Request
Alice <-- Bob: Another authentication Response
```

```mermaid
sequenceDiagram
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
Alice -> …
Run Code Online (Sandbox Code Playgroud)

markdown uml doxygen plantuml mermaid

5
推荐指数
1
解决办法
2632
查看次数

使用 reinterpret_cast 进行向下转换

我是一个喜欢深入细节的人。这次我创建了非常简单的功能,我称之为“场景”(查看代码)。首先给大家介绍一下我的看法:

struct ScenarioContext
{ virtual ~ScenarioContext() = default; };

struct IScenarioStep
{
    virtual ~IScenarioStep() = default;
    virtual void run( ScenarioContext& ) = 0;
};

struct ScenarioContainer final
{
    std::list<std::unique_ptr<IScenarioStep>> m_scenarioStepList;
};

struct Scenario
{
    explicit Scenario( ScenarioContainer&&, std::unique_ptr<ScenarioContext>&& = nullptr );

    void execute(); // Runs the steps one by one and passes context ref to steps

    std::unique_ptr<ScenarioContext> m_context;
    ScenarioContainer                m_container;
};
Run Code Online (Sandbox Code Playgroud)

现在示例“ScenarioStep”实现:

struct SimpleContext
    : ScenarioContext
{
    bool isFirstStepDone  = false;
    bool isSecondStepDone = false;
    bool isThirdStepDone  = false;
}; …
Run Code Online (Sandbox Code Playgroud)

c++ performance casting downcast

1
推荐指数
1
解决办法
68
查看次数

标签 统计

c++ ×1

casting ×1

downcast ×1

doxygen ×1

markdown ×1

mermaid ×1

performance ×1

plantuml ×1

uml ×1