| 32 | namespace cmDebugger { |
| 33 | |
| 34 | std::shared_ptr<cmDebuggerVariables> cmDebuggerVariablesHelper::Create( |
| 35 | std::shared_ptr<cmDebuggerVariablesManager> const& variablesManager, |
| 36 | std::string const& name, bool supportsVariableType, |
| 37 | cmPolicies::PolicyMap const& policyMap) |
| 38 | { |
| 39 | static std::map<cmPolicies::PolicyStatus, std::string> policyStatusString = { |
| 40 | { cmPolicies::PolicyStatus::OLD, "OLD" }, |
| 41 | { cmPolicies::PolicyStatus::WARN, "WARN" }, |
| 42 | { cmPolicies::PolicyStatus::NEW, "NEW" }, |
| 43 | }; |
| 44 | |
| 45 | return std::make_shared<cmDebuggerVariables>( |
| 46 | variablesManager, name, supportsVariableType, [=]() { |
| 47 | std::vector<cmDebuggerVariableEntry> ret; |
| 48 | ret.reserve(cmPolicies::CMPCOUNT); |
| 49 | for (int i = 0; i < cmPolicies::CMPCOUNT; ++i) { |
| 50 | if (policyMap.IsDefined(static_cast<cmPolicies::PolicyID>(i))) { |
| 51 | auto status = policyMap.Get(static_cast<cmPolicies::PolicyID>(i)); |
| 52 | std::ostringstream ss; |
| 53 | ss << "CMP" << std::setfill('0') << std::setw(4) << i; |
| 54 | ret.emplace_back(ss.str(), policyStatusString[status]); |
| 55 | } |
| 56 | } |
| 57 | return ret; |
| 58 | }); |
| 59 | } |
| 60 | |
| 61 | std::shared_ptr<cmDebuggerVariables> cmDebuggerVariablesHelper::CreateIfAny( |
| 62 | std::shared_ptr<cmDebuggerVariablesManager> const& variablesManager, |
no test coverage detected