Case Status
Log In

Wiki

Options

 
Whole Tomato Software - Home
  • RSS Feed

Move Implementation to Header File / Class Declaration

Refactoring with Move Implementation to Header File provides C/C++ users with an efficient means to move the implementation of a function to a header file. Similarly, Move Implementation to Class Declaration moves the implementation of a method inside its class declaration.

The two refactoring commands are ostensibly the reverse of Move Implementation to Source File.

Access

Place the caret on a function or method in a source file. If the symbol is a function, select Move Implementation to Header File from the Quick Action and Refactoring menu (Shift+Alt+Q).

If the symbol is a member of a class, select Move Implementation to Class Declaration.

Location of Implementation

A function is moved to the appropriate header file and the inline implementation replaces an existing declaration. If a declaration does not exist, the move occurs anyhow; hence, you can use the refactoring to create inline functions from usage. After a move, the implementation remains selected so it can be easily moved.

If preprocessor directives surround a declaration, they surround the inline implementation.

A method, as opposed to a function, is moved to its class declaration in place of an existing declaration. As with functions, if a declaration does not exist, the move occurs in any regard.

Comments

If Visual Assist is reasonably confident that comments before an implementation are associated with the implementation, the comments are moved as well.

Parameters

If parameter names in an implementation differ from the optional names in the corresponding declaration, the names from the implementation are retained after a move.

Default values in the declaration of a function or method are also retained.

Format

You can modify the format of the target implementations by editing the VA Snippet for Create Implementation.

Navigation

Use the Navigate commands of Visual Assist to jump between the header file and source file after moving an implementation. Immediately after a refactoring, Alt+Left returns you to the source location. Alt+Right returns you to the target implementation.