Maki
Formally verified low-code orchestration
Toggle main menu visibility
Loading...
Searching...
No Matches
document_cloner.h
1
#pragma once
2
3
#include <QHash>
4
#include <QPointF>
5
#include <QString>
6
#include <QVector>
7
#include <memory>
8
#include <optional>
9
10
#include "node_info.h"
11
12
class
FlowSaveInfo
;
13
class
TransitionSaveInfo
;
14
class
IParameter;
15
16
class
DocumentCloner final
17
{
18
public
:
19
// Produces a detached, fully cloned node subtree.
20
// Does not modify SaveInfo or publish events.
21
static
NodeSaveInfo
cloneNodeForPaste(
const
NodeSaveInfo
& original,
const
QString& newParentId,
const
QPointF& position);
22
23
private
:
24
DocumentCloner() =
default
;
25
26
// Pass 1: assign IDs to all objects before cloning references.
27
void
indexNode(
const
NodeSaveInfo
& node);
28
void
indexFlow(
const
FlowSaveInfo
& flow);
29
30
// Pass 2: clone the objects and remap their references.
31
std::shared_ptr<NodeSaveInfo> cloneNode(
const
NodeSaveInfo
& original,
const
std::optional<QString>& parentOverride,
const
QPointF& positionOffset);
32
33
std::shared_ptr<FlowSaveInfo> cloneFlow(
const
FlowSaveInfo
& original,
const
QString& newOwnerId);
34
35
std::shared_ptr<TransitionSaveInfo> cloneTransition(
const
TransitionSaveInfo
& original,
const
QPointF& positionOffset);
36
37
static
QVector<std::shared_ptr<IParameter>> cloneParameters(
const
QVector<std::shared_ptr<IParameter>>& parameters);
38
39
QString mappedNodeId(
const
QString& originalId)
const
;
40
41
// Maps are shared by the entire clone operation.
42
QHash<QString, QString> mNodeIds;
43
QHash<QString, QString> mFlowIds;
44
45
// Preserve shared identity if a node/flow is referenced
46
// more than once inside the source graph.
47
QHash<QString, std::shared_ptr<NodeSaveInfo>> mClonedNodes;
48
QHash<QString, std::shared_ptr<FlowSaveInfo>> mClonedFlows;
49
};
FlowSaveInfo
Represents the save information for a flow.
Definition
flow_info.h:15
NodeSaveInfo
Represents a node that can be saved and loaded.
Definition
node_info.h:16
TransitionSaveInfo
Represents transition save information.
Definition
transition_info.h:14
Generated for
MAKI
· © 2026 with
Doxygen
1.9.8
GitHub
Research