Is it possible to easily re-organize C++ functions within VS2013?

125 views Asked by At

Is there any way to easily organize my C++ functions within Visual Studio 2013? My Data Structures course requires that all functions be sorted alphabetically as part of the coding standard, and doing it by hand is getting very tiresome.

EDIT: Here is the relevant part of the coding standard, for those who are interested.

  1. FUNCTIONS

5.1 Function prototypes should be defined in the header file.[1]

5.2 Function definitions should be defined in the implementation file.[1]

5.3 All function prototypes and definitions must be sorted in ascending order based on function names.[2]

5.4 Functions should be small and concise to avoid developing overly complex functions.

5.5 Functions must be separated by at least one blank line.

5.6 Functions must have the following statements:

i. Pre: What are the conditions needed before calling this function?

ii. Post: What are the conditions after the function is completed?

iii. Purpose: What is this function supposed to do?

iv. Author: Who implemented this function? This is needed only if the project is completed in a team setting

Example:

/* Pre: None
 * Post: Welcome displayed to the screen
 * Purpose: Display Greeting message to the user
 *********************************************************/

void sayHi()
{
    cout << "Welcome\n";
}

[1] If the project is large enough, otherwise not needed.

[2] For class member functions, the functions should be list in ascending order within their own section.

1

There are 1 answers

9
Jonathan Mee On BEST ANSWER

You can collapse functions using the '+' icon in the left-hand margin.

Then you can either drag them up and down or place the cursor on the collapsed line and press Alt + Up or Alt + Down to move them.

If you collapse everything to start with it greatly simplifies the process.

EDIT:

Ctrl + M + O to collapse all
Ctrl + M + L to expand all