1// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4#ifndef OBJECTS_HPP
5#define OBJECTS_HPP
6
7#include <QObject>
8
9namespace objects {
10
11/**
12 * Copies all properties of source into destination. The optional parameter "overwrite" allows to control
13 * if existing properties on the destination should be overwritten or not. Defaults to true (overwrite).
14 */
15template <class T, class K>
16T mixin(T destination, K source, bool overwrite = true)
17{
18 if (overwrite) {
19 // TODO(mozart):Modify according to the comment.
20 // The set of additional module information exposed by the debug adapter.
21 destination.additionalModuleColumns = source.additionalModuleColumns;
22 // The set of characters that should trigger completion in a REPL. If not
23 // specified, the UI should assume the '.' character.
24 destination.completionTriggerCharacters = source.completionTriggerCharacters;
25 // Available exception filter options for the 'setExceptionBreakpoints'
26 // request.
27 destination.exceptionBreakpointFilters = source.exceptionBreakpointFilters;
28 // The debug adapter supports the 'terminateDebuggee' attribute on the
29 // 'disconnect' request.
30 destination.supportTerminateDebuggee = source.supportTerminateDebuggee;
31 // Checksum algorithms supported by the debug adapter.
32 destination.supportedChecksumAlgorithms = source.supportedChecksumAlgorithms;
33 // The debug adapter supports the 'breakpointLocations' request.
34 destination.supportsBreakpointLocationsRequest = source.supportsBreakpointLocationsRequest;
35 // The debug adapter supports the 'cancel' request.
36 destination.supportsCancelRequest = source.supportsCancelRequest;
37 // The debug adapter supports the 'clipboard' context value in the 'evaluate'
38 // request.
39 destination.supportsClipboardContext = source.supportsClipboardContext;
40 // The debug adapter supports the 'completions' request.
41 destination.supportsCompletionsRequest = source.supportsClipboardContext;
42 // The debug adapter supports conditional breakpoints.
43 destination.supportsConditionalBreakpoints = source.supportsConditionalBreakpoints;
44 // The debug adapter supports the 'configurationDone' request.
45 destination.supportsConfigurationDoneRequest = source.supportsConfigurationDoneRequest;
46 // The debug adapter supports data breakpoints.
47 destination.supportsDataBreakpoints = source.supportsDataBreakpoints;
48 // The debug adapter supports the delayed loading of parts of the stack, which
49 // requires that both the 'startFrame' and 'levels' arguments and an optional
50 // 'totalFrames' result of the 'StackTrace' request are supported.
51 destination.supportsDelayedStackTraceLoading = source.supportsDelayedStackTraceLoading;
52 // The debug adapter supports the 'disassemble' request.
53 destination.supportsDisassembleRequest = source.supportsDisassembleRequest;
54 // The debug adapter supports a (side effect free) evaluate request for data
55 // hovers.
56 destination.supportsEvaluateForHovers = source.supportsEvaluateForHovers;
57 // The debug adapter supports 'filterOptions' as an argument on the
58 // 'setExceptionBreakpoints' request.
59 destination.supportsExceptionFilterOptions = source.supportsExceptionFilterOptions;
60 // The debug adapter supports the 'exceptionInfo' request.
61 destination.supportsExceptionInfoRequest = source.supportsExceptionInfoRequest;
62 // The debug adapter supports 'exceptionOptions' on the
63 // setExceptionBreakpoints request.
64 destination.supportsExceptionOptions = source.supportsExceptionOptions;
65 // The debug adapter supports function breakpoints.
66 destination.supportsFunctionBreakpoints = source.supportsFunctionBreakpoints;
67 // The debug adapter supports the 'gotoTargets' request.
68 destination.supportsGotoTargetsRequest = source.supportsGotoTargetsRequest;
69 // The debug adapter supports breakpoints that break execution after a
70 // specified number of hits.
71 destination.supportsHitConditionalBreakpoints = source.supportsHitConditionalBreakpoints;
72 // The debug adapter supports adding breakpoints based on instruction
73 // references.
74 destination.supportsInstructionBreakpoints = source.supportsInstructionBreakpoints;
75 // The debug adapter supports the 'loadedSources' request.
76 destination.supportsLoadedSourcesRequest = source.supportsLoadedSourcesRequest;
77 // The debug adapter supports logpoints by interpreting the 'logMessage'
78 // attribute of the SourceBreakpoint.
79 destination.supportsLogPoints = source.supportsLogPoints;
80 // The debug adapter supports the 'modules' request.
81 destination.supportsModulesRequest = source.supportsModulesRequest;
82 // The debug adapter supports the 'readMemory' request.
83 destination.supportsReadMemoryRequest = source.supportsReadMemoryRequest;
84 // The debug adapter supports restarting a frame.
85 destination.supportsRestartFrame = source.supportsRestartFrame;
86 // The debug adapter supports the 'restart' request. In this case a client
87 // should not implement 'restart' by terminating and relaunching the adapter
88 // but by calling the RestartRequest.
89 destination.supportsRestartRequest = source.supportsRestartRequest;
90 // The debug adapter supports the 'setExpression' request.
91 destination.supportsSetExpression = source.supportsSetExpression;
92 // The debug adapter supports setting a variable to a value.
93 destination.supportsSetVariable = source.supportsSetVariable;
94 // The debug adapter supports stepping back via the 'stepBack' and
95 // 'reverseContinue' requests.
96 destination.supportsStepBack = source.supportsStepBack;
97 // The debug adapter supports the 'stepInTargets' request.
98 destination.supportsStepInTargetsRequest = source.supportsStepInTargetsRequest;
99 // The debug adapter supports stepping granularities (argument 'granularity')
100 // for the stepping requests.
101 destination.supportsSteppingGranularity = source.supportsSteppingGranularity;
102 // The debug adapter supports the 'terminate' request.
103 destination.supportsTerminateRequest = source.supportsTerminateRequest;
104 // The debug adapter supports the 'terminateThreads' request.
105 destination.supportsTerminateThreadsRequest = source.supportsTerminateThreadsRequest;
106 // The debug adapter supports a 'format' attribute on the stackTraceRequest,
107 // variablesRequest, and evaluateRequest.
108 destination.supportsValueFormattingOptions = source.supportsValueFormattingOptions;
109 } else {
110 // mix not supported yet.
111 }
112 return destination;
113}
114
115}
116
117#endif // OBJECTS_HPP
118