clang-tools 20.0.0git
|
An interface base for small context-sensitive refactoring actions. More...
#include <Tweak.h>
Classes | |
struct | Effect |
struct | Selection |
Input to prepare and apply tweaks. More... | |
Public Member Functions | |
virtual | ~Tweak ()=default |
virtual const char * | id () const =0 |
A unique id of the action, it is always equal to the name of the class defining the Tweak. | |
virtual bool | prepare (const Selection &Sel)=0 |
Run the first stage of the action. | |
virtual Expected< Effect > | apply (const Selection &Sel)=0 |
Run the second stage of the action that would produce the actual effect. | |
virtual std::string | title () const =0 |
A one-line title of the action that should be shown to the users in the UI. | |
virtual llvm::StringLiteral | kind () const =0 |
Describes what kind of action this is. | |
virtual bool | hidden () const |
Is this a 'hidden' tweak, which are off by default. | |
An interface base for small context-sensitive refactoring actions.
To implement a new tweak use the following pattern in a .cpp file: class MyTweak : public Tweak { public: const char* id() const override final; // defined by REGISTER_TWEAK. // implement other methods here. }; REGISTER_TWEAK(MyTweak);
|
virtualdefault |
Run the second stage of the action that would produce the actual effect.
EXPECTS: prepare() was called and returned true.
|
inlinevirtual |
|
pure virtual |
A unique id of the action, it is always equal to the name of the class defining the Tweak.
Definition is provided automatically by REGISTER_TWEAK.
|
pure virtual |
Describes what kind of action this is.
EXPECTS: prepare() was called and returned true.
|
pure virtual |
Run the first stage of the action.
Returns true indicating that the action is available and should be shown to the user. Returns false if the action is not available. This function should be fast, if the action requires non-trivial work it should be moved into 'apply'. Returns true iff the action is available and apply() can be called on it.
|
pure virtual |
A one-line title of the action that should be shown to the users in the UI.
EXPECTS: prepare() was called and returned true.