Search code examples
c++refactoringautomated-refactoring

Help with automated renaming in C++


Here is my issue:

I have a large library of code where all of the class names begin with Agui. For example:

class AguiWidget
{

};

class AguiBitmap
{

};

also, all the hpp and cpp files are named like this also: AguiWidget.hpp

etc.

The library also does not use a namespace.

all of the enums begin and use Agui: ex:

enum AguiKeyEnum
{
   AGUI_KEY_SPACE,
   AGUI_KEY_ENTER
};

The include guards also use ex: AGUI_WIDGET_HPP

So,

My task is to remove all the Agui, AGUI references from the entire project (all the classes and enums), then to encapsulate all the classes into namespace agui.

What would be the easiest way to do this. I also need the hpp and cpp files to no longer have Agui in the filename.

I use MSVC 2008 as an IDE if that helps.

Thanks!


Solution

  • You need to use a global find and replace tool. If you have Visual Studio 2008, then it is already built-in. Once you rename all the classes and namespaces, then use another tool to rename the files or build a script to do it for you.