For Programmers: Free Programming Magazines  


Home > Archive > Visual Studio > March 2004 > Macro to export class definitions









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Macro to export class definitions
Eric Margheim

2004-03-28, 10:32 pm

I don't have any experience in writing macros for Visual Studio 6 and need a
simple macro that goes through all the .h files in a directory and exports
to a delimited file the class name and, if applicable, the class from which
it is derived.

That sounds pretty simple. Can someone give me some sample code on that or
point me to some help on writing this?

Thanks much



Jase

2004-03-28, 10:32 pm

"Eric Margheim" <NOSPAM***eric@prism-grp.com***NOSPAM> wrote in message
news:OfOc9TeEEHA.684@tk2msftngp13.phx.gbl...
> I don't have any experience in writing macros for Visual Studio 6 and need

a
> simple macro that goes through all the .h files in a directory and exports
> to a delimited file the class name and, if applicable, the class from

which
> it is derived.
>
> That sounds pretty simple. Can someone give me some sample code on that

or
> point me to some help on writing this?
>
> Thanks much
>
>


Don't make life difficult for yourself. If you know C++, use it. Use
CFileFind to enumerate the files in the directory. Search the file for a
line starting with the keyword "class". To ignore forward declarations,
check that the line doesn't end with a ";". Extract the name, which will be
the next field (white space delimited), before the ":", if there is one.
Then copy the rest of the line verbatim to show the derivations.

You can get a list of all the .h files in your project by searching the dsp
file for lines starting with "SOURCE".

Put all that into a dialog app, which either takes the root path as a
parameter, or provides access to a CFileDialog so you can choose the
directory yourself. The other option is to copy the app into a directory,
and have the code act on the directory in which the program resides. Compile
a vers, chuck away all the intermediate objects for space saving reasons,
and your done.

Jase


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com