Classwizard / add member function
-
Is there any way to "tweak" the output of the classwizard? What I want to do is add some Doxygen comments on "new class", "add member function" and so on. For example, adding a new function does something like this (header):
void myFunc(int hello);
while I would prefer this:
/*! \fn void myFunc(int hello)
* myFunc description
* \param hello
* \return
*/
void myFunc(int hello);Right now I am using a very ugly macro, that does not work very well. Can this be done in a simple way? Thanks /moliate
-
Is there any way to "tweak" the output of the classwizard? What I want to do is add some Doxygen comments on "new class", "add member function" and so on. For example, adding a new function does something like this (header):
void myFunc(int hello);
while I would prefer this:
/*! \fn void myFunc(int hello)
* myFunc description
* \param hello
* \return
*/
void myFunc(int hello);Right now I am using a very ugly macro, that does not work very well. Can this be done in a simple way? Thanks /moliate
You should consider beatifying your macro, because modifying the class wizard to do your bidding won’t work. I tried doing something similar a few years back, and I ran into several problems: 1) The resource used to write the function implementation is the same one used to write the declaration. Meaning that you would get duplicates of any additions you make, one in the *.h file and the same in the *.cpp file. Also the one added to the *.h will have to be manually removed, as it messes with the class wizards parser. 2) The resource ‘script’ parser is not very advanced. It simply grabs the stuff out of the reswource string line-by-line without doing any validation. Take for example the following WM_SIZE handler resource; 1: OnSize 2: void 3: UINT nType, int cx, int cy 4: %1::%2(nType, cx, cy); 5: 6: %4 Add your message handler code here Line 1 is used to name the handler, and as the display string in the class wizard. Line 2 is the return type Line 3 is the handler’s parameter list Line 4 generates code that calls the handler’s base class Line 5 adds a blank line to the code Line 6 is that stupid comment you delete instantly So, you could add your comment into line 2, but you’d have to enter it all on the one line. Then once you used the class wizard to inserted it, you’d have to delete the comment out of the *.h (so that you don’t confuse the class wizard’s parser) and then format the comment in the *.cpp. If your still interested in taking a look at all of this stuff just look for the MFCCLWZ.DLL file in your Visual Studio installation directory under “Common\MSDev98\Bin”. It’s all in there, under the "STRINGARRAY" resource type. cheers, -Ben
-
You should consider beatifying your macro, because modifying the class wizard to do your bidding won’t work. I tried doing something similar a few years back, and I ran into several problems: 1) The resource used to write the function implementation is the same one used to write the declaration. Meaning that you would get duplicates of any additions you make, one in the *.h file and the same in the *.cpp file. Also the one added to the *.h will have to be manually removed, as it messes with the class wizards parser. 2) The resource ‘script’ parser is not very advanced. It simply grabs the stuff out of the reswource string line-by-line without doing any validation. Take for example the following WM_SIZE handler resource; 1: OnSize 2: void 3: UINT nType, int cx, int cy 4: %1::%2(nType, cx, cy); 5: 6: %4 Add your message handler code here Line 1 is used to name the handler, and as the display string in the class wizard. Line 2 is the return type Line 3 is the handler’s parameter list Line 4 generates code that calls the handler’s base class Line 5 adds a blank line to the code Line 6 is that stupid comment you delete instantly So, you could add your comment into line 2, but you’d have to enter it all on the one line. Then once you used the class wizard to inserted it, you’d have to delete the comment out of the *.h (so that you don’t confuse the class wizard’s parser) and then format the comment in the *.cpp. If your still interested in taking a look at all of this stuff just look for the MFCCLWZ.DLL file in your Visual Studio installation directory under “Common\MSDev98\Bin”. It’s all in there, under the "STRINGARRAY" resource type. cheers, -Ben
Thanks for the clarification on how mfcclwz.dll is organized. I have fired up ResHacker and started looking at it. You are probably right about it being simpler writing a better macro, but it is nice to get a better understanding on how the classwizard works! Cheers /moliate