I inherited a Visual Studio project containing hundreds of files.
I would like to extract all typedefs, structs and union from each .h / .cpp file and put the results in a file).
Each type of typdef / struct / union must be on the same line in the result file. This will make sorting easier.
typdef int myType;
struct myFirstStruct {char a; int b; ...}; union Part_Number_Serial_Number_Part_2_Response_Message_Type {struct {Message_Response_Head_Type Head; Part_Num_Serial_Num_Part_2_Report_Array Part_2_Report; Message_Tail_Type Tail;} Data; BYTE byData [140];} myUnion ;
struct {bool c; int d; ...} mySecondStruct ;
My problem is that I don't know what to look for (typedef / structs / union grammar) using regex. I can’t believe that no one has done this before (I searched Google and found nothing on this).
Does anyone know regular expressions for them? (Note that some of them are commented using // others / * * /)
Or a tool to achieve this.
Edit:
I play with the idea of automatically generating source code and / or dialogs to modify messages that use the base typedef / struct / union. I was going to use the output to create an XML file that could be used for this reason.
The source for them is in C / C ++ and is used in almost all of my projects. These projects are usually NOT C / C ++. Using the XML version, I would only need to update / add typedef / struct / union in only one place, and all projects will be able to auto-generate the source and / or dialogs.
source share