| 68 | } |
| 69 | |
| 70 | dap::array<dap::Variable> cmDebuggerVariables::HandleVariablesRequest() |
| 71 | { |
| 72 | dap::array<dap::Variable> variables; |
| 73 | |
| 74 | if (GetKeyValuesFunction) { |
| 75 | auto values = GetKeyValuesFunction(); |
| 76 | for (auto const& entry : values) { |
| 77 | if (IgnoreEmptyStringEntries && entry.Type == "string" && |
| 78 | entry.Value.empty()) { |
| 79 | continue; |
| 80 | } |
| 81 | variables.push_back(dap::Variable{ |
| 82 | {}, |
| 83 | {}, |
| 84 | {}, |
| 85 | entry.Name, |
| 86 | {}, |
| 87 | PrivateDataHint, |
| 88 | SupportsVariableType ? entry.Type : dap::optional<dap::string>(), |
| 89 | entry.Value, |
| 90 | 0 }); |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | EnumerateSubVariablesIfAny(variables); |
| 95 | |
| 96 | if (EnableSorting) { |
| 97 | std::sort(variables.begin(), variables.end(), |
| 98 | [](dap::Variable const& a, dap::Variable const& b) { |
| 99 | return a.name < b.name; |
| 100 | }); |
| 101 | } |
| 102 | return variables; |
| 103 | } |
| 104 | |
| 105 | void cmDebuggerVariables::EnumerateSubVariablesIfAny( |
| 106 | dap::array<dap::Variable>& toBeReturned) const |