Changeset View
Changeset View
Standalone View
Standalone View
debuggers/common/mi/micommand.h
Show First 20 Lines • Show All 76 Lines • ▼ Show 20 Line(s) | 70 | public: | |||
---|---|---|---|---|---|
77 | */ | 77 | */ | ||
78 | virtual bool autoDelete() { return true; } | 78 | virtual bool autoDelete() { return true; } | ||
79 | }; | 79 | }; | ||
80 | 80 | | |||
81 | class FunctionCommandHandler : public MICommandHandler { | 81 | class FunctionCommandHandler : public MICommandHandler { | ||
82 | public: | 82 | public: | ||
83 | typedef std::function<void (const ResultRecord&)> Function; | 83 | typedef std::function<void (const ResultRecord&)> Function; | ||
84 | 84 | | |||
85 | FunctionCommandHandler(const Function& callback, CommandFlags flags = nullptr); | 85 | explicit FunctionCommandHandler(const Function& callback, CommandFlags flags = nullptr); | ||
86 | 86 | | |||
87 | void handle(const ResultRecord&) override; | 87 | void handle(const ResultRecord&) override; | ||
88 | bool handlesError() override; | 88 | bool handlesError() override; | ||
89 | 89 | | |||
90 | private: | 90 | private: | ||
91 | CommandFlags _flags; | 91 | CommandFlags _flags; | ||
92 | Function _callback; | 92 | Function _callback; | ||
93 | }; | 93 | }; | ||
94 | 94 | | |||
95 | /** | 95 | /** | ||
96 | * @author John Birch | 96 | * @author John Birch | ||
97 | */ | 97 | */ | ||
98 | 98 | | |||
99 | class MICommand | 99 | class MICommand | ||
100 | { | 100 | { | ||
101 | protected: | 101 | protected: | ||
102 | MICommand(CommandType type, const QString& arguments = QString(), CommandFlags flags = nullptr); | 102 | explicit MICommand(CommandType type, const QString& arguments = QString(), CommandFlags flags = nullptr); | ||
103 | friend class KDevMI::MIDebugSession; | 103 | friend class KDevMI::MIDebugSession; | ||
104 | 104 | | |||
105 | public: | 105 | public: | ||
106 | 106 | | |||
107 | virtual ~MICommand(); | 107 | virtual ~MICommand(); | ||
108 | 108 | | |||
109 | CommandType type() const; | 109 | CommandType type() const; | ||
110 | virtual QString miCommand() const; | 110 | virtual QString miCommand() const; | ||
▲ Show 20 Lines • Show All 164 Lines • ▼ Show 20 Line(s) | 274 | { | |||
275 | QPointer<Handler> guarded_this(handler_this); | 275 | QPointer<Handler> guarded_this(handler_this); | ||
276 | handler = [guarded_this, handler_method]() { | 276 | handler = [guarded_this, handler_method]() { | ||
277 | if (guarded_this) { | 277 | if (guarded_this) { | ||
278 | (guarded_this.data()->*handler_method)(); | 278 | (guarded_this.data()->*handler_method)(); | ||
279 | } | 279 | } | ||
280 | }; | 280 | }; | ||
281 | } | 281 | } | ||
282 | 282 | | |||
283 | SentinelCommand(const Function& handler, CommandFlags flags = nullptr) | 283 | explicit SentinelCommand(const Function& handler, CommandFlags flags = nullptr) | ||
284 | : MICommand(NonMI, QString(), flags) | 284 | : MICommand(NonMI, QString(), flags) | ||
285 | , handler(handler) | 285 | , handler(handler) | ||
286 | { | 286 | { | ||
287 | } | 287 | } | ||
288 | 288 | | |||
289 | using MICommand::invokeHandler; | 289 | using MICommand::invokeHandler; | ||
290 | void invokeHandler() | 290 | void invokeHandler() | ||
291 | { | 291 | { | ||
▲ Show 20 Lines • Show All 86 Lines • Show Last 20 Lines |