| 449 | } |
| 450 | |
| 451 | void Preference::loadMixResMapping(const std::string &resourceMappingPath) { |
| 452 | BLOG("loading resource mapping : %s", resourceMappingPath.c_str()); |
| 453 | std::string content = loadFileContent(resourceMappingPath); |
| 454 | if (content.empty()) |
| 455 | return; |
| 456 | std::vector<std::string> lines; |
| 457 | splitString(content, lines, '\n'); |
| 458 | for (std::string line: lines) { |
| 459 | if (line.find(".R.id.") == std::string::npos) |
| 460 | continue; |
| 461 | size_t startPos = 0; |
| 462 | if ((startPos = line.find("0x") != std::string::npos) |
| 463 | && ((startPos = line.find(':')) != std::string::npos)) { |
| 464 | line = line.substr(startPos + 1); |
| 465 | } |
| 466 | startPos = 0; |
| 467 | stringReplaceAll(line, " ", ""); |
| 468 | stringReplaceAll(line, ".R.id.", ":id/"); |
| 469 | startPos = line.find("->"); |
| 470 | if (startPos == std::string::npos) { |
| 471 | continue; |
| 472 | } |
| 473 | std::string resId = line.substr(0, startPos); |
| 474 | std::string mixedResid = line.substr(startPos + 2); |
| 475 | BDLOG("res id %s mixed to %s", resId.c_str(), mixedResid.c_str()); |
| 476 | this->_resMapping[resId] = mixedResid; |
| 477 | this->_resMixedMapping[mixedResid] = resId; |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | void Preference::loadValidTexts(const std::string &pathOfValidTexts) { |
| 482 | std::string fileContent = loadFileContent(pathOfValidTexts); |
no test coverage detected