================
@@ -0,0 +1,45 @@
+//===-- Request.h 
---------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_TOOLS_LLDB_DAP_REQUEST_REQUEST_H
+#define LLDB_TOOLS_LLDB_DAP_REQUEST_REQUEST_H
+
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/JSON.h"
+
+namespace lldb_dap {
+struct DAP;
+
+class Request {
+public:
+  Request(DAP &dap) : dap(dap) {}
+  virtual ~Request() = default;
+
+  virtual void operator()(const llvm::json::Object &request) = 0;
+
+  static llvm::StringLiteral getName() { return "invalid"; };
+
+  enum LaunchMethod { Launch, Attach, AttachForSuspendedLaunch };
+
+  void SendProcessEvent(LaunchMethod launch_method);
+  void SetSourceMapFromArguments(const llvm::json::Object &arguments);
+
+protected:
+  DAP &dap;
+};
+
+class AttachRequest : public Request {
+public:
+  using Request::Request;
+  static llvm::StringLiteral getName() { return "attach"; }
+  void operator()(const llvm::json::Object &request) override;
----------------
JDevlieghere wrote:

Not directly, no, but you can do exactly what you did in your PR. Have this 
function take a `const protocol::Request &req` and then implement it int terms 
of types unique to the class. They become an implementation detail of the 
`RequestHandler` that nobody else needs to know about. 

https://github.com/llvm/llvm-project/pull/128262
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to