Sorry, but I don't understand the export you are talking about: can yoy explain it better, please?
(May be you are talking about a C++ feature that I don't know).
When I'm writing a new class, I include the implementation in the header file for speediness. This way I don't have to always switch between the .h and .cpp files to add members and methods, I just stay in the .h file until I am done with the testing phase for the class.
class foo
{
...
void bar()
{
...
}
};
What I am suggesting for an export feature is to right click on the method in the .h file and click "export/move implementation" to have it automatically copy the method to the .cpp file (maintaining the order of declarations in the class), and then just leave the declaration in the header file.
foo.h:
class foo
{
...
void bar();
};
foo.cpp:
#include "foo.h"
...
void foo::bar()
{
...
}
Does it make sense, now? Or am I the only person who works like this?
For the reverse work: yes, I thought about the problems you mentioned and my solution was
1) when it is asked to add the declaration, show a little window with a combobox where you can choose between public, private, ecc.
2) add it to the first (or last) good line, then you can move it with your mouse (better a drag-drop than writing it yourself)
Do you agree?
Seems a bit complicated. Almost as much work as just copy/pasting the function definition.
kidmosey: with gcc, you can use #pragma to define implementation and definition in the same file, and leave them there. This is not compatible with Visual Studio, and probably not compatible with other compilers either.
Example:
foo.h:
#pragma interface
class foo
{
...
void bar()
{
...
};
};
foo.c:
#pragma implementation
#include "foo.h"
Here's a link to the official gcc page for a full explanation: http://www.delorie.com/gnu/docs/gcc/gcc_96.html (http://www.delorie.com/gnu/docs/gcc/gcc_96.html)
In short: files with "#pragma interface" are only compiled when a "#pragma implementation" is found first. Otherwise, that file is just used as a definition.
foo.h:
class foo
{
...
void bar();
};
foo.cpp:
#include "foo.h"
...
void foo::bar()
{
...
}
Does it make sense, now? Or am I the only person who works like this?