| 80 | } |
| 81 | |
| 82 | ExitCodes main_(int, const char **) override |
| 83 | { |
| 84 | |
| 85 | //------------------------------------------------------------- |
| 86 | // parameter handling |
| 87 | //------------------------------------------------------------- |
| 88 | |
| 89 | String in1 = getStringOption_("in1"); |
| 90 | String in2 = getStringOption_("in2"); |
| 91 | double acceptable_ratio = getDoubleOption_("ratio"); |
| 92 | double acceptable_absdiff = getDoubleOption_("absdiff"); |
| 93 | StringList whitelist = getStringList_("whitelist"); |
| 94 | StringList raw_matched_whitelist = getStringList_("matched_whitelist"); |
| 95 | int verbose_level = getIntOption_("verbose"); |
| 96 | int tab_width = getIntOption_("tab_width"); |
| 97 | int first_column = getIntOption_("first_column"); |
| 98 | |
| 99 | // This is for debugging the parsing of whitelist_ from cmdline or ini file. Converting StringList back to String is intentional. |
| 100 | writeDebug_(String("whitelist: ") + String(whitelist) + " (size: " + whitelist.size() + ")", 1); |
| 101 | writeDebug_(String("matched_whitelist: ") + String(raw_matched_whitelist) + " (size: " + raw_matched_whitelist.size() + ")", 1); |
| 102 | |
| 103 | OpenMS::FuzzyStringComparator fsc; |
| 104 | |
| 105 | std::vector< std::pair<std::string, std::string> > parsed_matched_whitelist; |
| 106 | for (Size i = 0; i < raw_matched_whitelist.size(); i++) |
| 107 | { |
| 108 | |
| 109 | // Split each entry at the colon to produce a pair of strings |
| 110 | std::vector<String> tmp; |
| 111 | raw_matched_whitelist[i].split(":", tmp); |
| 112 | if (tmp.size() != 2) |
| 113 | { |
| 114 | throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, |
| 115 | String(raw_matched_whitelist[i]) + " does not have the format String1:String2"); |
| 116 | } |
| 117 | |
| 118 | parsed_matched_whitelist.emplace_back(tmp[0], tmp[1]); |
| 119 | } |
| 120 | |
| 121 | fsc.setAcceptableRelative(acceptable_ratio); |
| 122 | fsc.setAcceptableAbsolute(acceptable_absdiff); |
| 123 | fsc.setWhitelist(whitelist); |
| 124 | fsc.setMatchedWhitelist(parsed_matched_whitelist); |
| 125 | fsc.setVerboseLevel(verbose_level); |
| 126 | fsc.setTabWidth(tab_width); |
| 127 | fsc.setFirstColumn(first_column); |
| 128 | |
| 129 | if (fsc.compareFiles(in1, in2)) |
| 130 | { |
| 131 | return EXECUTION_OK; |
| 132 | } |
| 133 | else |
| 134 | { |
| 135 | // TODO think about better exit codes. |
| 136 | return PARSE_ERROR; |
| 137 | } |
| 138 | } |
| 139 |
nothing calls this directly
no test coverage detected