| 1 | 
tim | 
1823 | 
 | 
| 2 | 
  | 
  | 
#include "utils/Utility.hpp" | 
| 3 | 
  | 
  | 
 | 
| 4 | 
  | 
  | 
namespace oopse { | 
| 5 | 
  | 
  | 
 | 
| 6 | 
  | 
  | 
bool replaceWithWildCard(std::vector<std::vector<std::string>::iterator>& cont, | 
| 7 | 
  | 
  | 
                                             std::vector<std::string>& sequence, std::vector<std::string>& result, | 
| 8 | 
  | 
  | 
                                             const std::string& wildCard = "X") { | 
| 9 | 
  | 
  | 
    if (cont.size() > sequence.size()) { | 
| 10 | 
  | 
  | 
        std::cerr << "the size of iterator container is greater than the size of sequence"; | 
| 11 | 
  | 
  | 
    } | 
| 12 | 
  | 
  | 
 | 
| 13 | 
  | 
  | 
    bool hasMoreCombination = next_combination(cont, sequence.begin(), sequence.end()); | 
| 14 | 
  | 
  | 
    if (hasMoreCombination) { | 
| 15 | 
  | 
  | 
        result.clear(); | 
| 16 | 
  | 
  | 
        result.insert(result.begin(), sequence.size(), wildCard); | 
| 17 | 
  | 
  | 
        std::vector<std::vector<std::string>::iterator>::iterator i; | 
| 18 | 
  | 
  | 
        for ( i = cont.begin(); i != cont.end(); i++){ | 
| 19 | 
  | 
  | 
            result[*i - sequence.begin()] = **i; | 
| 20 | 
  | 
  | 
        } | 
| 21 | 
  | 
  | 
    } | 
| 22 | 
  | 
  | 
 | 
| 23 | 
  | 
  | 
     return hasMoreCombination; | 
| 24 | 
  | 
  | 
     | 
| 25 | 
  | 
  | 
}//end replaceWildCard | 
| 26 | 
  | 
  | 
 | 
| 27 | 
  | 
  | 
} |