| 351 | } |
| 352 | |
| 353 | void Preference::resolveTreePruning(const ElementPtr &elem, const std::string &activity) { |
| 354 | if (!this->_treePrunings.empty()) { |
| 355 | for (const auto &prun: this->_treePrunings) { |
| 356 | if (prun->activity != activity) |
| 357 | continue; |
| 358 | XpathPtr xpath = prun->xpath; |
| 359 | std::vector<ElementPtr> xpathElemts; |
| 360 | if (!xpath) |
| 361 | continue; |
| 362 | if (elem->matchXpathSelector(xpath)) { |
| 363 | BLOG("pruning node %s for xpath: %s", elem->getResourceID().c_str(), |
| 364 | xpath->toString().c_str()); |
| 365 | bool resetResid = 0 != InvalidProperty.compare(prun->resourceID); |
| 366 | bool resetContent = 0 != InvalidProperty.compare(prun->contentDescription); |
| 367 | bool resettext = 0 != InvalidProperty.compare(prun->text); |
| 368 | bool resetclassname = 0 != InvalidProperty.compare(prun->classname); |
| 369 | |
| 370 | if (resetResid) |
| 371 | elem->reSetResourceID(prun->resourceID); |
| 372 | if (resetContent) |
| 373 | elem->reSetContentDesc(prun->contentDescription); |
| 374 | if (resettext) |
| 375 | elem->reSetText(prun->text); |
| 376 | if (resetclassname) |
| 377 | elem->reSetClassname(prun->classname); |
| 378 | } |
| 379 | } |
| 380 | } |
| 381 | } |
| 382 | |
| 383 | void Preference::pruningValidTexts(const ElementPtr &element) { |
| 384 | if (!element || this->_validTexts.empty()) |
no test coverage detected