class Rule

Declaration

class Rule : public RefactoringActionRule { /* full declaration omitted */ };

Description

A refactoring action rule is a wrapper class around a specific refactoring action rule (SourceChangeRefactoringRule, etc) that, in addition to invoking the action, describes the requirements that determine when the action can be initiated.

Declared at: clang/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h:125

Inherits from: RefactoringActionRule

Member Variables

private std::tuple<RequirementTypes...> Requirements

Method Overview

  • public Rule(std::tuple<RequirementTypes...> Requirements)
  • public bool hasSelectionRequirement()
  • public void invoke(clang::tooling::RefactoringResultConsumer & Consumer, clang::tooling::RefactoringRuleContext & Context)
  • public void visitRefactoringOptions(clang::tooling::RefactoringOptionVisitor & Visitor)

Inherited from RefactoringActionRule:

Inherited from RefactoringActionRuleBase:

Methods

Rule(std::tuple<RequirementTypes...> Requirements)

Declared at: clang/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h:127

Parameters

std::tuple<RequirementTypes...> Requirements

bool hasSelectionRequirement()

Description

Returns true when the rule has a source selection requirement that has to be fulfilled before refactoring can be performed.

Declared at: clang/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h:137

void invoke(
    clang::tooling::RefactoringResultConsumer&
        Consumer,
    clang::tooling::RefactoringRuleContext&
        Context)

Description

Initiates and performs a specific refactoring action. The specific rule will invoke an appropriate \c handle method on a consumer to propagate the result of the refactoring action.

Declared at: clang/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h:130

Parameters

clang::tooling::RefactoringResultConsumer& Consumer
clang::tooling::RefactoringRuleContext& Context

void visitRefactoringOptions(
    clang::tooling::RefactoringOptionVisitor&
        Visitor)

Description

Traverses each refactoring option used by the rule and invokes the\c visit callback in the consumer for each option. Options are visited in the order of use, e.g. if a rule has two requirements that use options, the options from the first requirement are visited before the options in the second requirement.

Declared at: clang/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h:142

Parameters

clang::tooling::RefactoringOptionVisitor& Visitor