/src/CMake/Source/cmDebuggerVariablesManager.cxx
Line | Count | Source |
1 | | /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
2 | | file LICENSE.rst or https://cmake.org/licensing for details. */ |
3 | | |
4 | | #include "cmDebuggerVariablesManager.h" |
5 | | |
6 | | #include <utility> |
7 | | #include <vector> |
8 | | |
9 | | #include <cm3p/cppdap/protocol.h> |
10 | | #include <cm3p/cppdap/types.h> |
11 | | |
12 | | namespace cmDebugger { |
13 | | |
14 | | void cmDebuggerVariablesManager::RegisterHandler( |
15 | | int64_t id, |
16 | | std::function<dap::array<dap::Variable>(dap::VariablesRequest const&)> |
17 | | handler) |
18 | 0 | { |
19 | 0 | VariablesHandlers[id] = std::move(handler); |
20 | 0 | } |
21 | | |
22 | | void cmDebuggerVariablesManager::UnregisterHandler(int64_t id) |
23 | 0 | { |
24 | 0 | VariablesHandlers.erase(id); |
25 | 0 | } |
26 | | |
27 | | dap::array<dap::Variable> cmDebuggerVariablesManager::HandleVariablesRequest( |
28 | | dap::VariablesRequest const& request) |
29 | 0 | { |
30 | 0 | auto it = VariablesHandlers.find(request.variablesReference); |
31 | |
|
32 | 0 | if (it != VariablesHandlers.end()) { |
33 | 0 | return it->second(request); |
34 | 0 | } |
35 | | |
36 | 0 | return dap::array<dap::Variable>(); |
37 | 0 | } |
38 | | |
39 | | } // namespace cmDebugger |