| 128 | } |
| 129 | |
| 130 | void ConfigCommand::CollectStrings(const ParamClass& cls, const std::string& path, const std::string& prefix, |
| 131 | std::vector<std::pair<std::string, std::string>>& out) |
| 132 | { |
| 133 | for (int i = 0; i < cls.GetEntryCount(); i++) |
| 134 | { |
| 135 | const ParamEntry& entry = cls.GetEntry(i); |
| 136 | std::string entryPath = |
| 137 | path.empty() ? std::string(entry.GetName().Data()) : path + "." + std::string(entry.GetName().Data()); |
| 138 | |
| 139 | if (entry.IsClass()) |
| 140 | { |
| 141 | const ParamClass* sub = entry.GetClassInterface(); |
| 142 | if (sub) |
| 143 | CollectStrings(*sub, entryPath, prefix, out); |
| 144 | } |
| 145 | else if (entry.IsArray()) |
| 146 | { |
| 147 | for (int j = 0; j < entry.GetSize(); j++) |
| 148 | { |
| 149 | const IParamArrayValue& val = entry[j]; |
| 150 | if (val.IsTextValue()) |
| 151 | { |
| 152 | const char* v = val.GetValueRaw().Data(); |
| 153 | if (v && v[0] == '$' && strncmp(v + 1, prefix.c_str(), prefix.size()) == 0) |
| 154 | { |
| 155 | std::string idx = entryPath + "[" + std::to_string(j) + "]"; |
| 156 | out.emplace_back(idx, v); |
| 157 | } |
| 158 | } |
| 159 | } |
| 160 | } |
| 161 | else if (entry.IsTextValue()) |
| 162 | { |
| 163 | const char* v = entry.GetValueRaw().Data(); |
| 164 | if (v && v[0] == '$' && strncmp(v + 1, prefix.c_str(), prefix.size()) == 0) |
| 165 | out.emplace_back(entryPath, v); |
| 166 | } |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | static std::string Trim(std::string s) |
| 171 | { |
nothing calls this directly
no test coverage detected