| 42 | } |
| 43 | |
| 44 | bool extractedParamsAre(const string stepMatch, map<std::ptrdiff_t, string> params) { |
| 45 | MatchResult::match_results_type resultSet = getResultSetFor(stepMatch); |
| 46 | if (resultSet.size() != 1) { |
| 47 | return false; // more than one match |
| 48 | } |
| 49 | SingleStepMatch match = resultSet.front(); |
| 50 | if (params.size() != match.submatches.size()) { |
| 51 | return false; |
| 52 | } |
| 53 | SingleStepMatch::submatches_type::const_iterator rsi; |
| 54 | for (rsi = match.submatches.begin(); rsi != match.submatches.end(); ++rsi) { |
| 55 | if (params.find(rsi->position) == params.end()) |
| 56 | return false; |
| 57 | if (rsi->value != params[rsi->position]) { |
| 58 | return false; |
| 59 | } |
| 60 | } |
| 61 | return true; |
| 62 | } |
| 63 | |
| 64 | private: |
| 65 | MatchResult::match_results_type getResultSetFor(const string& stepMatch) { |