* @brief ConfigParser::GetConfigFalsePositives - Parse false positive strings from the config. * @return False positives. */
| 48 | * @return False positives. |
| 49 | */ |
| 50 | FALSE_POSITIVES ConfigParser::GetConfigFalsePositives() |
| 51 | { |
| 52 | FALSE_POSITIVES falsePositives; |
| 53 | std::string currentCommaItem; |
| 54 | std::stringstream falsePositiveStream; |
| 55 | std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter; |
| 56 | |
| 57 | // |
| 58 | // Check if there is anything for us to parse. |
| 59 | // |
| 60 | if(configMap.count("false_positive_sourcepath") == 0) |
| 61 | { |
| 62 | printf("ConfigParser!GetConfigFalsePositives: No source path false positives to parse.\n"); |
| 63 | } |
| 64 | if(configMap.count("false_positive_targetpath") == 0) |
| 65 | { |
| 66 | printf("ConfigParser!GetConfigFalsePositives: No target path false positives to parse.\n"); |
| 67 | } |
| 68 | if(configMap.count("false_positive_stackhistory") == 0) |
| 69 | { |
| 70 | printf("ConfigParser!GetConfigFalsePositives: No stack history false positives to parse.\n"); |
| 71 | } |
| 72 | |
| 73 | if(configMap.count("false_positive_sourcepath") != 0) |
| 74 | { |
| 75 | falsePositiveStream = std::stringstream(configMap["false_positive_sourcepath"]); |
| 76 | // |
| 77 | // Enumerate source path false positives. |
| 78 | // |
| 79 | while(falsePositiveStream.good()) |
| 80 | { |
| 81 | std::getline(falsePositiveStream, currentCommaItem, ','); |
| 82 | if(configMap.count(currentCommaItem) == 0) |
| 83 | { |
| 84 | printf("ConfigParser!GetConfigFalsePositives: false_positive_sourcepath had invalid false positive named %s.\n", currentCommaItem.c_str()); |
| 85 | continue; |
| 86 | } |
| 87 | falsePositives.SourcePathFilter.push_back(converter.from_bytes(configMap[currentCommaItem])); |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | if(configMap.count("false_positive_targetpath") != 0) |
| 92 | { |
| 93 | falsePositiveStream = std::stringstream(configMap["false_positive_targetpath"]); |
| 94 | // |
| 95 | // Enumerate target path false positives. |
| 96 | // |
| 97 | while(falsePositiveStream.good()) |
| 98 | { |
| 99 | std::getline(falsePositiveStream, currentCommaItem, ','); |
| 100 | if(configMap.count(currentCommaItem) == 0) |
| 101 | { |
| 102 | printf("ConfigParser!GetConfigFalsePositives: false_positive_targetpath had invalid false positive named %s.\n", currentCommaItem.c_str()); |
| 103 | continue; |
| 104 | } |
| 105 | falsePositives.TargetPathFilter.push_back(converter.from_bytes(configMap[currentCommaItem])); |
| 106 | } |
| 107 | } |