Lisp:member-functions.el expands member functions from C++ header files into C++ source files, if they aren’t already there.
It used to be available at http://www.bit-net.com/~ral/ but that link is broken now. Get it from the above link instead (the file was copied from http://www.koders.com/lisp/fidF0A58536B3672659E044FBF7D78AB7DDE8034C66.aspx).
It doesn’t support namespaces. Contact BarneyDalton to prompt him to publish a modified version that does work with namespaces.
For example, make a small file:
class Sample {
public:
void init();
void add( int x );
void sub( int x );
};Name it “Sample.H”, and save it.
Type “M-x expand-member-functions”.
Press return to accept default values when prompted for the name of the file to read, and the name of the file to write.
Open “Sample.C”, and you will see the following:
void Sample::init()
{
} void Sample::add(int x)
{
} void Sample::sub(int x)
{
}Homepage: https://github.com/tuhdo/semantic-refactor
Semantic Refactor is a refactoring tool for C/C++ based on Semantic parser framework
Features:
- Context-sensitive menu offers appropriate refactoring actions
- Generate class implementation (also handles nested class and class template)
- Generate class getters and setters
- Generate function implementation (also handles function template)
- Generate function prototype
- Convert function to function pointer
- Convert function to function parameter
- Move semantic units (class, function, variable)
- Extract function with proper type information
See also agulbra-make-member in KDE’s emacs setup http://websvn.kde.org/trunk/KDE/kdesdk/scripts/kde-emacs/ for another way of doing this.
The function depends on other functions, so you’ll best checkout the entire folder:
svn co svn://anonsvn.kde.org/home/kde/trunk/KDE/kdesdk/scripts/kde-emacs
It allows to create skeletons for member functions one by one, which is more flexible when working on a class over time. It also supports namespaces now.
kde-emacs-general.el in the same directory also has code to jump from the method definition in the header file to the method implementation in the source file, and back.
This seems broken on Emacs 22.1. – nschum