| 211 | } |
| 212 | |
| 213 | void ImportProject::fsSetDefines(FileSettings& fs, std::string defs) |
| 214 | { |
| 215 | while (defs.find(";%(") != std::string::npos) { |
| 216 | const std::string::size_type pos1 = defs.find(";%("); |
| 217 | const std::string::size_type pos2 = defs.find(';', pos1+1); |
| 218 | defs.erase(pos1, pos2 == std::string::npos ? pos2 : (pos2-pos1)); |
| 219 | } |
| 220 | while (defs.find(";;") != std::string::npos) |
| 221 | defs.erase(defs.find(";;"),1); |
| 222 | while (!defs.empty() && defs[0] == ';') |
| 223 | defs.erase(0, 1); |
| 224 | while (!defs.empty() && endsWith(defs,';')) |
| 225 | defs.pop_back(); |
| 226 | bool eq = false; |
| 227 | for (std::size_t pos = 0; pos < defs.size(); ++pos) { |
| 228 | if (defs[pos] == '(' || defs[pos] == '=') |
| 229 | eq = true; |
| 230 | else if (defs[pos] == ';') { |
| 231 | if (!eq) { |
| 232 | defs.insert(pos,"=1"); |
| 233 | pos += 3; |
| 234 | } |
| 235 | if (pos < defs.size()) |
| 236 | eq = false; |
| 237 | } |
| 238 | } |
| 239 | if (!eq && !defs.empty()) |
| 240 | defs += "=1"; |
| 241 | fs.defines.swap(defs); |
| 242 | } |
| 243 | |
| 244 | static bool simplifyPathWithVariables(std::string &s, std::map<std::string, std::string, cppcheck::stricmp> &variables) |
| 245 | { |