Ejemplo n.º 1
0
bool applyAllReplacements(const Replacements &Replaces, Rewriter &Rewrite) {
    bool Result = true;
    for (Replacements::const_iterator I = Replaces.begin(),
            E = Replaces.end();
            I != E; ++I) {
        if (I->isApplicable()) {
            Result = I->apply(Rewrite) && Result;
        } else {
            Result = false;
        }
    }
    return Result;
}
Ejemplo n.º 2
0
bool applyAllReplacements(Replacements &Replaces, Rewriter &Rewrite) {
  bool Result = true;
  for(Replacements::iterator B = Replaces.begin(),
                             I = B,
                             E = Replaces.end();
      I != E; ++I) {
    Replacements::iterator S = std::search(I+1,E,I,I+1,Replacement::Equal());
    if (S != E)
    {
      I = Replaces.erase(I)-1;
      E = Replaces.end();
    }
  }
  for (Replacements::const_iterator I = Replaces.begin(),
                                    E = Replaces.end();
       I != E; ++I) {
    if (I->isApplicable()) {
      Result = I->apply(Rewrite) && Result;
    } else {
      Result = false;
    }
  }
  return Result;
}